Why Snippet Manager doesn't works?
Asked Answered
N

2

6

I really want to use this plugin. But once I do "Export as Snippet", I can't see a new tab where I can manage the snippet, set the Shourcut and such (as shown in the video). I only see this popup:

enter image description here

What is going on? Add new item?

I've updated to the last (update 3) version of Visual Studio 2015, and I've Snippet Designer 1.6.2.

Norry answered 21/11, 2016 at 12:0 Comment(1)
I have updated my answer (yet again!) with a workaround that will allow you to continue creating snippets with Snippet Designer, in Web Site projects (Web Forms), in Visual Studio 2015. Tested and working. I have also made a suggestion as to where the author might investigate the issue; at the moment I am afraid I simply have no more time to spend on this, perhaps over the weekend I can continue.Coin
C
2

UPDATE - WORKAROUND, AND POSSIBLE FUTURE FIX

I have tested Snippet Designer with Web Forms (Web Site Projects), and it does not work as described in the video, i.e. with the snippet file being automatically created.

However, it is possible to continue working with Snippet Designer, by selecting the Project Item named Code Snippet, as follows:

  1. Create or open a Web Site project.

  2. Select the text you wish to make a Snippet. Right click and select Export as Snippet.

Selecting text to Export as Snippet

  1. In the New File Dialog window that opens, you need to locate the File Type Code Snippet. The easiest way in a long list of installed File Templates is to use the search feature, typing snippet.

Locating the 'Code Snippet' Project Item

  1. Click Add. The file will be added to your project, and now Snippet Designer will activate, and function as normal.

Snippet Designer working with Web Forms, Visual Studio 2015

NOTE: This is creating a default C# Code Snippet file, not the snippet file that is included within the Snippet Designer .vsix archive; it makes no difference as both files are empty, and Snippet Designer has its own code for building the contents of a snippet file according to the relevant XML schema, as specified by Microsoft.

A possible reason why Snippet Designer does not automatically create the snippet file itself, as it does with other projects, is that Web Site projects use a different approach to project metadata; for example, they do not have a .csproj file, which is typically used to list the files within a project.

It could also be that the code creating the snippet file asks Visual Studio, via Automation, to create a new instance of the snippet file Item Template; on a default Visual Studio 2015 installation, the listing of available Item Templates for a Web Site Project are located in:

C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\WebNewFileItems\NewFileItems.vsdir

Snippet Designer also includes a .vsdir file that has an entry for its own bundled snippet file, the source can be viewed here:

https://github.com/mmanela/SnippetDesigner/blob/master/src/SnippetDesigner/Templates/SnippetFile.vsdir

I would suggest the author of Snippet Designer investigate if the entry here is the source of the problem.

Microsoft provide documentation for the metadata contained in .vsdir files here: Template Directory Description (.Vsdir) Files

I do actually recommend a different product. My original answer continues below:


CURRENT SITUATION

As has been documented on the Snippet Designer GitHub Issue Tracker, there are issues with specific project types not being recognised, and therefore features not available.

The last commit to the Snippet Designer GitHub project was 1 year ago (November 2015); in view of the number of unresolved issues and lack of development, I would suggest a known working open source alternative.

WORKING ALTERNATIVE

Code Snippet Studio is another free, open source project for creating, editing and managing Snippets that fully supports Visual Studio 2015 (including Update 3), and which is actively developed and released:

Code Snippet Studio

Code Snippet Studio is an extension for Visual Studio 2015 that makes it easy to create, edit, package, and share IntelliSense code snippets for Visual Studio 2015 and Visual Studio Code. For C# and Visual Basic snippets, it also provides live Roslyn code analysis as you type to immediately detect code issues.

Note that multiple languages, including C#, VB, SQL, HTML, JavaScript are supported, among others. The image below shows VB editing.

Code Snippet Studio runs as either a Tool Window in Visual Studio 2015, or, as a standalone application (which personally I find ideal for working alongside Visual Studio Code on a laptop, or to make quick updates to my snippet packages).

enter image description here

Features include Roslyn based intellisense and analysis while editing snippets, specification of namespaces that need to be imported to support the Snippet, the ability to export to Visual Studio or Visual Studio Code, and optionally, create a VSIX file for installation on multiple machines.

FURTHER INFORMATION

For more information, the following links are useful:

Channel 9 - A Look Behind Code Snippet Studio (with Video)

GitHub Project

Getting started Guide

Channel9 - One code snippet at a time [and more] with the Code Snippet Studio

Coin answered 30/11, 2016 at 16:24 Comment(5)
Is this working also with a WebForm project? For what I see, there is where the problem come from. Can you try?Norry
I do not usually use Web Forms - but I will test this and let you know. The alternative, Code Snippet Studio, that I recommend in my answer certainly does (and supports any project type that supports the Visual Studio snippet mechanism), as you simply copy and paste into it. I have already spent a bit of time on this - have you tried the answer that yesterday had two upvotes within 10 minutes, and was awarded 250 bonus points.. surely that is working as described ? ;-)Coin
I didn't set any "awarded 250 bonus". That's not correct, it doesnt works!Norry
I know it does not work - it never could, as I politely explained in the comments. However, if a Bonus has been set for a question, it must be awarded in a certain period of time. When that expires, as it did yesterday, the system has an algorithm for awarding the bonus. First it looks for an accepted answer, and if it cannot find one, it looks for the highest rated answer that has 2 upvotes or more, and automatically awards half the bonus to it. As I mentioned, that answer received exactly 2 upvotes in the space of 10 minutes yesterday. Purely a coincidence, I am sure ... ;)Coin
I have updated my answer with more information regarding Web Site projects. If I can find time I will update if it is possible to resolve.Coin
A
1

This is a known problem, see github issues 57, 70, 84, 109. I can only suggest that you persuade addon author to fix it, or fix it yourself :)

Andersonandert answered 25/11, 2016 at 20:40 Comment(2)
I've persuaded author to fix it!Norry
Upvoted for suggesting the project is fixed at source. I will look at the code and see if I can assist. In the meantime, there are alternatives, as I have suggested elsewhere.Coin

© 2022 - 2024 — McMap. All rights reserved.