IntelliSense has forgotten my code snippets! - visual-studio

I have a stack of code snippets imported into Visual Studio. Just recently, they have stopped displaying in Intellisense.
If the keyboard shortcut doesn't bring up anything else on IntelliSense, then I can tab and the code snippet is inserted just fine.
However, if the keyboard shortcut for the snippet happens to also bring up other items in IntelliSense, tabbing will select the first of those items, so I actually can't use the code snippet at all!
Does anyone have any ideas why IntelliSense would be unable to list my code snippet shortcuts? I started using ReSharper recently, but that wouldn't be the problem surely?!
Thanks for your help
David

It is certainly connected to installing Resharper. First thing it does is turn IntelliSense off. Check this question for help with preserving your snippets.

I know I am late to the party but you can use snippet editor to copy your snippet then paste it into Resharper through the live template editor. The code appears to be compatible. I did that with several of mine and it works just fine.

Since ReSharper 4 Visual Studio code snippets are imported into ReSharper as live templates. That means you can invoke any code snippet by pressing Ctrl+J.
All the scripts imported in Vs are available on this popup menu.

Related

Set VS 2013 Keyboard Shortcuts to different functions conditionally?

I have recently started working in Visual Studio 2013. Before this I worked extensively in Qt's IDE. One feature I really liked in Qt was that you could highlight a block of code and press CTRL+/ to comment each line in the block, then if every line in the block was already commented out, you could press CTRL+/ again to uncomment the lines. I figured out how to set the comment block shortcut in VS to CTRL+/ but I can't figure out a way to set the uncomment to that as well if everything is commented, like in Qt. Is there a way to do this? Thanks!
You can't toggle comment like that in visual studio without using micro or third party extension, but I know for a fact that you can do it with Resharper, take a look at this.

Visual studio 2010, how to use code snippets in a method call

I moved from Visual Studio 2008 to Visual Studio 2010.
My code snippets work good in Visual Studio 2010 on the start of a line, but not when adding parameters to a methodcall. This did work in Visual Studio 2008.
So when i type this : "DoSomeMethod([nowiwantmycodennippets!]", the code snippets are not in the intellisense list.
Does anyone know if this is a setting, or just not working anymore, and if it can be fixed?
This appears to be bug. If you type your snippet name (i.e. noiwantmycodesnippets) and press ESC to dismiss the completion list (if open), then you can press Tab to insert your code snippet. So it's just a matter of the code snippets missing from the completion list.
You can use the Control+K, Control+X key chord to show the code snippets' list also. But this isn't as nice as using it through the completion list.
Are you using ReSharper? If so, Resharper Intellisense overwrites the VS default one, so that i.e. code snippets do no appear in the completions. Try turning off ReSharper Intellisense in the ReSharper Options (Environment->Intellisense->General, choose Visual Studio).
If ReSharper Intellisense is a must, you'll have to create a ReSharper "Live Template" which opens up for "code snippets" behaviour, only ReSharper is way more advanced -- see for example this one http://www.brianlow.com/index.php/2009/04/06/resharper-live-templates-for-nunit/.
On my machine I just type "public void Test(" and than ctrl+space and type the name of my snippet. Works like a charm. I've got the C# keyboard shortcuts, I think.

Missing snippet in Visual Studio

I have the same installation of Visual Studio on two machines, but on one, I can't find the snippet "propdp" for DependencyProperty. I only have prop/propg, can't really understand why. Is there an addon I have to install?
Came across this same issue myself today after a fresh install of VS2008 on Win7 64
All I had to do to fix it was to
Go to Tools > Code Snippets Manager
Select Visual C# from the drop down menu
Click Add
Select the NetFx30 directory containing the code snippets, in my case it was...
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC#\Snippets\1033\NetFX30
You should immediately be able to use the code snippet.
I think ReSharper hides some of the default snippets. It should be enough to enter the snippet and press tab twice.
In my case, the snippet showed up in IntelliSense but nothing worked on selecting it and pressing enter or clicking on it, until I pressed tab+tab then it work. (I guess I was used to CodeRush).
Just in case anybody have this problem and the previous answer didn't fix it, if you have two folders inside C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC#\Snippets: 1033 and 3082. Copy and paste the whole content from one to the other and started to work.
Trying to import didn't fix it for me but maybe I didn't do it right... don't know...
I found it here: https://stackoverflow.com/a/36829804/5761877 (thanks be given to "elmonopascual")
I'm using VS2017 and had the same problem. The only thing that worked for me was:
Go to Tools > Code Snippets Manager
Select CSharp from the dropdown menu
Remove all folders in the listview (save the complete path of them for later steps)
Hit OK
Reopen the Code Snippets Manager
Select CSharp from the dropdown menu
Insert all the folders again with the Add button.
If I don't close and reopen the Manager before add the folders again, the VS2017 will crash and restart when I hit OK, and the snippets still won't work.
in my case i went to tools -> Code Snippet Manager, i realized that the path to the snippet i wanted has changed. So when the Path has changed the Snippet folder will be shown with an error. So i copied the Path and followed until i found out where it was missing. Then i browsed all the folders until i located snippet i wanted and my issue was solved.

Visual Studio 2010 Bookmarks problem

When I create bookmarks into editor code with Bookmarks window, work for a while adding methods, removing statements etc. and then I reopen the IDE the line number for bookmarks are wrong...
Any idea?
One way to work around this problem is to not close visual studio before finishing writing your code. The bookmarks will update if the program is still running, but will show the wrong lines if loading a save file.

How do I make the Enter key on intellisense when typeing in VB react the same way as in C# in Visual Studio?

I'm using Visual Studio 2008 and I'm used to C# where when Intellisense pops up, I select what I want by hitting enter and it doesn't skip down to the next line. In VB when I hit the enter on intellisense, I jump to the next line. Does anyone know where the setting for this intellisense option might be?
Hitting the SPACEBAR or TAB key in VB does the same thing that ENTER does in C#.
I know that this doesn't really answer your question, but intellisense is designed to work so that you just push the "next" character to choose the highlighted item (such as open parenthesis, period, semi-colon, etc).
I was bothered by this behavior in VB as well. This will be fixed in the next version of Visual Studio with a new setting for enter-key behavior.
https://github.com/dotnet/roslyn/pull/11873
Corrected link: https://github.com/dotnet/roslyn/pull/11769

Resources