JavaScript in VS11

2012-04-24

Today I was working on rewriting a complex AJAX page to use KnockoutJS and I used the new Visual Studio 11 editor for it.

There are some big improvements in VS11.

1. Better IntelliSense:
image
2. Completion hints:
image 3. Implicit references and immediate feedback on undefined objects. This was really nice while working with a returned JSON object from an AJAX call. IntelliSense will parse the file looking for identifiers and will show them (with a special icon) in the IntelliSense list.
image .
But one thing that annoyed me was the auto completion mode.

In C# I’m used to hitting the next character (a ; or ( for example) as soon as I see the right option in my IntelliSense. The editor will then autocomplete with the current item and everything works fine. In JavaScript, it’s another story. When hitting the next character, the editor doesn’t insert the IntelliSense item, but just chops of your current item.

So I started looking around if this could be changed and the good news is: it can be changed!
In the option screen there is an option for Statement Completion in JavaScript. Unchecking the box fixes everything!

image