This extension makes it possible to add/edit/remove c# snippets
directly from the IDE, instead of manually crafting XML snippet templates with the appropriate data to then import them via the built-in Code Snippets Manager.
Install from the Open VSIX gallery
via the Extensions -> Manage Extensions
menu (you might need to add the feed, see this) or download the latest CI build as a VSIX
package and install it manually.
- Note that the
releases
tab atGitHub
will either be empty or have out-of-date releases.
- A quick way to get to Snippeter is to add the extension to the toolbar, as shown in the image below (bottom right below) or to manually assign a shortcut to it via
Options -> Keyboard -> Addsnippet
.
-
If code has been selected in the editor when Snippeter is run, the window below pops up. There, it is possible to modify the code and add a description, shortcut, and title. The last two in red are required (as is some code).
-
Snippeter uses the
Avalon editor
so it has some of its nice features available, such as syntax-highlighting. -
After adding a snippet, the status bar will notify you of the achievement for a few seconds.
- If no code has been selected in the editor when Snippeter is run, it works in manager mode (see below) listing all snippets in your
c#
My Code Snippets folder.
-
Press delete to remove the selected snippet from the Code Snippets Manager (non-reversible operation).
-
Right-click on a listed snippet to code its full path to the clipboard.
-
Hover over an item in the list of snippets to see its description, code, and location without having to open it.
-
Double-click on a snippet to open it and modify its code in Snippeter's
Avalon editor
or to change its shortcut, description, or title, as shown below.
-
Click
Update snippet
to save any changes to the snippet orDismiss
to disregard any modification made. Both operations return to manager mode. -
Click on
Open snippet file
to open the snippet file in theIDE
. Be warned that other extensions might interfere with this operation (see Conflicts section below) and hang Visual Studio.
- If you want to work with your snippets, open Snippeter without selecting code. When code is selected, Snippeter is set to add that selected code as a new snippet and nothing more.
Snippeter only works with c# snippets
. If you need something else, fork the code. It's a mess but it works, I think.
The extension Snippet Designer interferes with, at least, attempts to open snippets in the IDE
and, thus, limits the functionality of Snippeter if both are installed simultaneously. If Snippet Designer
is indeed installed and does not hang Visual Studio, the snippet file will not be displayed in XML but via Snippet Designer
(for better or worse).