Provide IntelliSense for Function Overloads and Variables
View Signatures in the Statement Completion List
This means that as you are typing a function name, IntelliSense will pop-up the method signature to let you know which parameters you’ll need to pass (see Figure 3 below). When using this feature, you may quickly start to notice which developers on your team adhere to standardized and/or sensible parameter names
Figure 3: IntelliSense displaying Array.splice method signature
This works similar to the XML Documentation Comments-style support, except that it won’t be as detailed. It will only display the content of the JS comment for the method you are referencing. One interesting observation I had was that IntelliSense would not pop up the comment information for a method when trying to call it from the “global” scope. I don’t know if that was an intended feature or a bug, but as you can see in Figure 4, it works fine when inside functions.
Figure 4: IntelliSense displaying regular JS comment for a regular non-native function
VS 2012 now has a way for developers to extend the IntelliSense information for their libraries. There are several reasons why using XML or regular comments are not viable options. An example would be that the code uses a particular pattern that is incompatible with the IntelliSense engine. The IntelliSense extension feature in Visual Studio 2012 provides a way of “hooking” into the process to allow you to manually override what the IntelliSense engine displays. I personally think that most Developers will find this feature too time consuming to use and that its usage will probably be limited to MS specific libraries (especially for Windows 8 specific code).
View Statement Completion for Identifiers Even When Accurate Information about the Object Isn’t Available
This is an interesting feature, but in my opinion, it’s one that will not be instantly obvious to a lot of Developers. It basically means that when trying to complete information for an object, variable, or function, the IntelliSense Engine will look at the current file, analyze it, and then try to show the most accurate options based on the usage of similar objects, variables, or functions. It works well with files that are not monolithic in nature since the list of suggestions will be much shorter. Here is more information on how it works.
Get IntelliSense Information for Objects in Dynamically Loaded Scripts
This feature is a bit puzzling to me and there is not much information available from Microsoft about its specifics. The feature page states that it ‘provides automatic support for some recognizable script loader patterns,’ but no mention of which patterns or even an overview on how it works.
Control Which Objects are Available in Global Scope
I should mention that most of these IntelliSense features will only work (at least with non-native methods and objects) for code that is present in the current file you are working in. That is, if the code you are referring to lives in another file, you will need to add a reference directive like this one:
/// <reference path=”path.to.file.js” />
This functionality was somewhat there in the previous version of VS, but one enhancement that was made was the ability to add a ‘_reference.js’ file to your project that contains all your reference directives. Once added, all of your JS files should have IntelliSense features enabled without having to include the reference directives in each file.
Use Features of ECMAScript 5 and HTML5 DOM
IntelliSense engine now recognizes ECMAScript 5 constructs and also adds support for the newer HTML5 DOM API (like window.history, etc.). When developing with the new language features keep in mind that not all browsers are compatible at this time.
Use Smart Indenting, Brace Matching, and Outlining When You Write Code
Figure 5: Code folding feature
Use Go To Definition to Locate Function Definitions in Source Code
This is another useful feature that will definitely speed up development and cut down on trips to Ctrl+F to find stuff. It works very similar to the Go to Definition (F12) in C# and VB.
Set a Breakpoint within a Single Line of Code
If you have Visual Studio 2012 questions and/or looking for more great tips, please send us a tweet @CrederaMSFT. You can also check out other recent blogs on Visual Studio:
Ready to achieve your vision? We're here to help.
We'd love to start a conversation. Fill out the form and we'll connect you with the right person.
Searching for a new career?View job openings