Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Snippet Context?

I've built a code snippet, but am having an issue with the context where it's valid.

If I am on a new line of code and enter my snippet shortcut, it appears in the Intellisense list.

public void DoSomething()
{
  // insert code snippet here
}

However, if I am entering my snippet shortcut after an opening parenthesis, it does not appear while all the stock snippets seem to, like the "do" snippet, which I've modeled mine after.

public void DoSomething()
{
  DoSomethingElse( // insert code snippet here
}

Is there a reason custom snippets won't appear after a paren, while stock snippets do? And is there a way to make mine show up after a paren?

Thanks for any help.

Update: After a comment from stack72 in an answer below, after the Intellisense list appears, I hit ESC to deselect anything else and then hit tab-tab. While my shortcut does not appear in the list, it does, indeed execute.

While I'm closer to the answer, my questions remain: why don't my shortcuts show up in Intellisense after a paren, and how can I get them to appear there?

like image 803
Mark A Johnson Avatar asked Apr 30 '26 03:04

Mark A Johnson


1 Answers

if you press control + k, x then you will see a dialogue box that gives you the options of where to load the snippets from

if you have saved the snipped to your vs2010 settings folder then it will be in my snippets - you should be able to table into that list and select from there

like image 152
stack72 Avatar answered May 04 '26 07:05

stack72