2

I've recently created my first code snippet and the problem I'm having is that whenever I go to surround my code with something, instead of automatically selecting the usual "Visual C#" folder, it gives me a choice between "My code snippets" and "Visual C#".

I only want to insert the snippet via typing the shortcut defined in my .snippet file, and then selecting it with intellisense. Is there any way for me to set this up in either 2019, or any Visual Studio version? (VS Code included)

I've read through all the intelisense options as well as the code snippet menu to find if there's a way to either add the snippet to the default c# snippet area and found nothing. If I could find where the default ones are stored, I could add mine there I think.

1 Answer 1

1

In your .snippet file, set the <SnippetTypes> section like this:

<SnippetTypes>
  <SnippetType>Expansion</SnippetType>
</SnippetTypes>
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! It worked perfectly, just for future reference, that tag should be included in the header of the snippet. I found this documentation after checking what you've said. learn.microsoft.com/en-us/visualstudio/ide/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.