I have been making several improvements on code snippets that are typically built into VS2010. Is there any way to either "prefer" certain snippet directories over others, or to overwrite the defaults without manually removing the references from the Code Snippets window? I would like to keep the same shortcuts.
This is mostly nit-picking, since I could remove the .snippet files manually, or remove the folder references, but I'm wondering if there is an easier way, incase I end up replacing a large amount of the default snippets yet still want to keep others.
There are two issues that come up when having similar shortcuts on code snippets.
- For some snippets, such as
propdp
, you will be prompted that there are multiple snippets, and be asked to choose which one is appropriate. - For other snippets, such as
ctor
, it just uses the default snippet and pretends my own doesn't exist. Browsing the snippets using Ctrl+K,Ctrl+X clearly shows the snippet works, and the shortcut is correct.
The second issue here is a larger concern than the first.
Edit: Further experimentation shows that ctor
in particular uses the default snippet no matter what. I haven't tried overwriting the code in the original snippet file, but removing the reference to Visual C# snippets folder still uses the default and ignores my replacement.
Edit 2: Even replacing the original snippet, ctor
uses the default and ignores the .snippet file. This is after restarting Visual Studio as well. Now I have no idea where it's even retrieving this code snippet from. As a test, you can rename the snippet ctors
and it will display properly. ctor
is no longer a suggestion at this point. If you rename it back to ctor
, it will once again display the default snippet. Either this snippet is cached somewhere, or it's built in to VS2010.