views:

269

answers:

2

How do I stop VS 2010 (RC) from autocompleting html helpers with new object { ... } when I just want to pass in an anonymous type? Backspacing is driving me crazy.

e.g., VS wants:

<%=Html.ActionLink("Register", "Register", new object { controller = "Account" }) %>

I know the helper is declared expecting object, which is why it does this, but can I change this behavior just for mvc helpers?

A: 

Yes, it is annoying. I just press Escape after the space after new. This cancels the Intellisense window that will fill in object.

Graham Clark
A: 

Theres a button on the Text Editor toolbar that "Toggles between suggestion and standard completion modes" (the default shortcut for the C# developer keyboard layout is Ctrl+Alt+Space). It will prevent the editor from filling in the selected item if you just type "new {" (it's actually meant to allow use-first development).

Note: You will need to hit the up or down arrow to give focus to the suggestion if you actually want Intellisense to fill it in, otherwise typing one of the word-break characters will just dismiss the prompt without modifying what you have typed.

Rory
the toggle is nice -- great when you know you are going to be cranking out a bunch of view changes.
ericvg
@pinkmuppet: Yeah, and it goes well with `Ctrl+.` > `Generate x...` when actually want to use something before declaring it.
Rory