Erik Dekker
Erik Dekker

Reputation: 2433

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?

Upvotes: 3

Views: 1759

Answers (3)

mhoff
mhoff

Reputation: 403

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/.

Upvotes: 2

CodeNaked
CodeNaked

Reputation: 41393

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.

Upvotes: 2

Kees C. Bakker
Kees C. Bakker

Reputation: 33381

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.

Upvotes: 0

Related Questions