Skip to content

LaraSQP/Snippeter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Snippeter, a c# snippet extension for Visual Studio 2019

Build status License: MIT

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.

Setup

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 at GitHub will either be empty or have out-of-date releases.

Getting Started

  • Once installed, the Extensions menu will show the entry Command Add snippet, as shown below:

extensions

  • 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.

toolbar

  • 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.

editor

  • 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.

manager

  • 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.

editing

  • Click Update snippet to save any changes to the snippet or Dismiss to disregard any modification made. Both operations return to manager mode.

  • Click on Open snippet file to open the snippet file in the IDE. Be warned that other extensions might interfere with this operation (see Conflicts section below) and hang Visual Studio.

Note

  • 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.

Limitations

Snippeter only works with c# snippets. If you need something else, fork the code. It's a mess but it works, I think.

Conflicts

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).

About

A c# snippet extension for Visual Studio 2019

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages