Reputation: 1
When using Intellisennse with Visual Studio 2019 (C#) it doesn't show shortcuts anymore for my code snippets. I tried enabling Intellisense include all snippets option, but still code snippet shortcuts are not working. Any solutions for enabling shortcuts again in Visual studio?
Upvotes: 0
Views: 1856
Reputation: 1070
You mentioned "my code snippets", so I suppose you used the customized code snippets.
Please check these aspects:
1). In Visual Studio 2019 > Tools > Options > Text Editor > C# > IntelliSense > Snippets behavior, and make sure that you didn't select Never include snippets
option by accident.
2). Make sure you have added related codes to your customized code snippet file(.snippet
).
<Shortcut>XXXX</Shortcut>
And make sure that you have imported the customized code snippet file into the related folder/VS(remember to re-import(override) it if you changed some codes of .snippet
file, and remember to choose the Language
for CSharp).
If you indeed imported the file, the snippet file will be located in for example C:\Users\Administrator\Documents\Visual Studio 2019\Code Snippets\Visual C#\My Code Snippets
, you can check if it exists.
3). For using code snippet shortcuts, remember to press "Tab" key twice(once for Visual Basic, twice for C#) after you type the shortcut. For example, type XXXX in one new code line, and press "Tab" twice, and then the code snippet will be inserted.
Besides, there are some other troubleshooting suggestions, such as repairing VS, reset VS settings, you can also have a try. And I'm not sure if Resharper Extension or other extensions which you installed cause this issue, perhaps you can try to disable it and test again.
BTW, if you mean the default keyboard shortcut key for inserting/surrounding code snippets doesn't work, please check this > Tools > Options > Environment > Keyboard > Press shortcut keys > and make sure, the shortcut keys have been assigned(Ctrl + K/X => Edit.InsertSnippet, Ctrl + K/S => Edit.SurroundWith).
Upvotes: 2