Why is Snippet Manager not working?

I really want to use this plugin . But as soon as I do “Export as a fragment”, I don’t see a new tab where I can manage the fragment, install Shourcut , etc. (As shown in the video). I see this popup:

enter image description here

What's happening? Add new item?

I upgraded to the latest version (version 3) of Visual Studio 2015, and I have Designer 1.6.1.

+6
source share
2 answers

UPDATE - PROGRAMMING AND POSSIBLE FUTURE FIX

I tested Snippet Designer with web forms (website designs) and it does not work as described in the video, i.e. a fragment file is automatically created.

However , you can continue working with Snippet Designer by selecting a project item named Code Snippet as follows:

  • Create or open a website project.

  • Select the text you want to make a snippet. Right-click and select Export as Snippet .

Select text to export as a fragment

  1. In the "New File" dialog box that opens, you need to find the Code Snippet Type of the Code Snippet file. The easiest way in a long list of installed file templates is to use the search function by typing snippet .

Search for a project item

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

Snippet Web Form Designer Visual Studio 2015

NOTE This creates the default C # code snippet file, not the snippet file that is included in the Snippet Designer .vsix ; it doesn’t matter because both files are empty, and Snippet Designer has its own code to create the contents of the fragment file in accordance with the corresponding XML schema, as indicated by Microsoft.

The possible reason Snippet Designer does not automatically create the fragment file itself, as happens with other projects, is because website projects use a different approach to project metadata; for example, they do not have a .csproj file, which is usually used to display files in a project.

It may also be that the code that creates the snippet file is requested by Visual Studio through Automation to create a new instance of the Item Item Template; when installing Visual Studio 2015 by default, the list of available element templates for the website project is in:

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

Snippet Designer also contains a .vsdir file, in which there is an entry for its own linked fragment file, the source can be viewed here:

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

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

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

I really recommend another product. My initial answer continues below:


CURRENT SITUATION

As described in Snippet Designer GitHub Issue Tracker , there are problems when certain types of projects are not recognized, and therefore functions are not available.

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

WORKING ALTERNATIVE

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

Code Snippet Studio

Code Snippet Studio is an extension for Visual Studio 2015 that simplifies the creation, editing, packaging, and sharing of IntelliSense code snippets for Visual Studio 2015 and Visual Studio code. For C # and Visual Basic snippets, it also provides real-time analysis of Roslyn code when you type to immediately detect code problems.

Please note that several languages, including C # , VB , SQL , HTML , JavaScript . The image below shows VB editing.

Code Snippet Studio works either as a tool window in Visual Studio 2015, or as a standalone application (which I personally consider ideal for working with Visual Studio Code on a laptop or for quickly updating snippet packages).

enter image description here

Features include intellisense and analysis based on Roslyn when editing snippets, specifying namespaces that need to be imported to support Snippet, the ability to export to Visual Studio or Visual Studio Code and, if necessary, creating a VSIX file for installation on multiple machines.

ADDITIONAL INFORMATION

For more information, use the following links:

Channel 9 - Look behind the scenes Studio Snippet (with video)

Github project

Getting Started Guide

Channel9 - One piece of code at a time [or more] using Studio code snippet

+3
source

This is a known issue, see github problems 57 , 70 , 84 , 109 . I can only suggest that you convince the addon author to fix it or fix it yourself :)

+1
source

Source: https://habr.com/ru/post/1012526/


All Articles