Your official information source from the .NET Web Development and Tools group at Microsoft.
In Visual Studio 11 Beta, we have exciting JavaScript editing features for the developers. Last year, we blogged “JavaScript Web development differences between Visual Studio 11 Developer preview and Visual Studio 2010”. Here are the differences between Visual Studio 11 Beta and Visual Studio 2010.
Description
VS2010 Behavior
Visual Studio 11 Beta Behavior
Changed From VS11 Developer Preview
ECMAScript 5 compliance
No
Yes. Visual Studio 11 Developer Preview fully supports ECMAScript 5.
Auto-reducing Statement Completion List
Yes, if the IntelliSense is automatically enabled when typing.
The following screen shots shows all the document's statement completion items that contains character "al":
Completion Hint shows function signature
Yes, making completion hint more helpful.
IE DOM IntelliSense
No, change DOM based on the current schema and is hard to upgrade.
Yes, will get IntelliSense from IE10's DOM, which is implicitly referenced (see the next item for how to change implicit reference files).
Implicit references (js files that are always referenced for editor IntelliSense)
Yes, through tools->option->Text Editor->JavaScript->IntelliSense->References, "implicit (Web) " reference group for web projects and web sites.
In VS11 Developer Preview, there is only one implicit reference group for both Windows and Web development. In VS11 Beta, they are separated to Implicit (Windows) and Implicit (Web) reference groups. The JavaScript references will be automatically loaded for intelliSense usage according to project types, for example metro style JavaScript/HTML project will use "implicit (windows)" reference group, and web site/web applications will use "implicit (web)" reference group.
In VS11 Beta, all new web templates have scripts/_references.js file. This file needs to be updated if project script files names get changed. For example, if you change” jQuery.1.6.2.js” to “jQuery.1.7.1.js” in the project, the _references.js file content needs to be changed in order to get the jQuery intelliSense.
Yes.
Immediate feedback on undefined objects
Yes. We will show a list of all identifiers in the file when IntelliSense cannot determine the type of an object. The identifier list is recognizable by the use of a different icon next to each completion item and a tooltip indicating that all identifiers are being shown.
Ctrl+Shift+J to rebuild IntelliSense
Yes
Local IntelliSense is now automatically rebuild.
In VS11 Beta, Ctrl+Shift+J is used to refresh cached JavaScript files referenced from a remote site. The Refresh Remote References command will update the reference cache by downloading the latest version of referenced files from their remote location. This is new from VS11 Developer Preview.
named function expressions
var a = function namedFunc() {
//position 1
}
//position 2
Show IntelliSense in both position1 and position2 due to inaccuracy of the engine.
Better engine accuracy, only shows IntelliSense in position 2.
The distinction is that named function expressions identifiers are only visible within the scope of the function expression itself.
Script Loader dynamically add loaded JavaScript file as reference
Yes. Engine will take the dynamically loaded JavaScript for reference.
There is a known issue in Beta that affects remote JavaScript file loading. For example, the following does not work correctly in VS11 Beta. It will be resolved in future release.
<script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("jquery", "1.7.1"); // $ should work here but not </script>
Visual Studio 11 Developer Preview Behavior
IntelliSense Signature overloading
N/A
New feature
JavaScript XML documentation MSDN documentation
No.
A blog is used as reference:
For VS 11 Beta, the MSDN JavaScript XML documentation specification is in http://msdn.microsoft.com/en-us/library/hh524453(VS.110).aspx
Note, for field, param and var node, one attribute has not yet been added to the current MSDN preview documentation: value. It can be used to define some not-classed object s in the following example:
function Chair3(type) { this.type = type; this.color = "red"; } Chair3.prototype.getInfo = function () { return this.color + ' ' + this.type + ' Chair3'; }; //object literals var chair4 = { type: "wood", color: "red", getInfo: function () { return this.color + ' ' + this.type + ' chair4'; } } //singleton using function var chair5 = new function () { this.type = "wood"; this.color = "red"; this.getInfo = function () { return this.color + ' ' + this.type + ' chair5'; }; } var a = function (x, y, z) { /// <summary>Description</summary> /// <param name="x" type="Chair3">x</param> /// <param name="y" value="chair4">y</param> /// <param name="z" value="chair5">z</param> }
F9 set on a line with multiple statement
Select and break on whole line
Select and break on the statement where cursor is on, making debugging compressed JavaScript files possible.
Open remote extension-less JS files in JS editor
Yes, debug and step through the following will open jsapi in editor :
<script src="https://www.google.com/jsapi" type="text/javascript"></script> <script type="text/javascript"> google.load("jquery", "1.6.0"); </script>
MicrosoftAjax's IntelliSense filter, glyph and other support
Hard coded
Supported via MicrosoftAjax.intellisense.js file, which is located in [ProgramFiles]\Microsoft Visual Studio 11.0\JavaScript\References\MicrosoftAjax.intellisense.js
Note, In VS11 Developer preview, it was named MicrosoftAjax.vsextensions.js.
Outlining
Through extension
Supported
Brace matching
Brace highlighting
Go to Definition (F12)
Regular expression
No color coding, no validation
With color coding and validation
"use strict"; validation support (ECMAScript 5)
Consistency with IE JavaScript syntax checking
Yes, the JavaScript syntax error you see in VS will be the same as you see in IE.
jQuery Templates script block support, show IntelliSense, coloring and indent.
Sharepoint JS reference via http://site/SiteAssets/x.js
<script type="text/javascript" src= "http://site/SiteAssets/mylib.min.js"></script>
Dom Explorer
Supported when debugging with IE10 only
JavaScript Console
Customized JavaScript Snippet
Note, VS2010 customer snippet file is not compatible with Visual Studio 11 Developer Preview. An attribute needs to be changed in each snippet file from "jscript" to "JavaScript"
<Code Language="jscript">
... </Code>
Change to
<Code Language="JavaScript">
Name across product
Jscript
JavaScript
JavaScript editor Indenting/Tab setting usage
both indenting/tab settings:
* the HTML settings are used not matter how JScript is set when in Mark-up
* the JScript settings are used no matter how HTML is set when in JS File
Only tab settings: (indent settings are used according to the language)
* the HTML settings are used not matter how JavaScript is set when in Mark-up
JavaScript smart indenting in tools->options->text editors->JavaScript->Tabs
Block indenting as default, no smart indenting
Smart indenting is the default
Note, In Dev11 Developer Preview, block indenting is the default
Explicit /// reference in html/aspx/master/ascx files
/// specified in markup page does not add reference
/// also works in markup page's script block. It has to be on the top most script block. It will be useful for user control JavaScript explicit references. Also useful in edges cases such as following require.js syntax:
<script data-main="scripts/main" src="scripts/require.js"></script> <script type="text/javascript"> /// <reference path="scripts/a.js" /> function abc() { aFunctionFromAJs(); } </script>
In misc file project, JS file download remote reference (http reference)
Allowed by default
Disabled by default, with message in the output:
Downloading of remote references for files in the miscellaneous files project is disabled. To enable downloading of remote references, check the appropriate option in Tools | Options | Text Editor | JavaScript | IntelliSense | General
_variable (with leading underscore) shows or not in the referenced file
Default: Yes
MSAjax: No
Default: No
%VS11InstallationDirectory%\JavaScript\References\underscorefilter.js extension controls this. MSAjax extension controls it as well for MSAjax reference.
You can remove the control if you don't like this behavior from tools->option->Text Editor->JavaScript->IntelliSense->References, "implicit (Web) " reference group for web projects and web sites.
You feedback is very valuable for us. Please go to http://connect.microsoft.com/VisualStudio to let us know your issues and suggestions.
Best Regards,
Xinyang Qiu
Web Platform and Tools Team
Why is document.all even in the intellisense? Is should not be in there -- it's not in the DOM API! Please make editor actually follow the spec, and not what's in IE's API. *please*
@Brock Allen, the view the language service presents of the DOM is controlled by the DOM file included in your references. By default, for web applications, it is domWeb.js. Feel free to copy this to a different locations and delete the offending properties and then change the web reference to refer to your modified domWeb.js. For example, you might want to remove most or all the properties from MSHTMLElementExtensions.
@Chuck -- That's great news. I wasn't aware this is being driven off of a config file like that. But I do reaffirm my complaint that Microsoft is shipping (and tacitly promoting) a non-standard DOM. I still think the IE API should not be there by default (or maybe even provide a config setting in Tools->Options).
Not know exactly what happened,
When I create new html file and paste my html code. I thing I have paste 2 times. I CTRL+A select all and remove them and paste again. I am not able to do this in Beta.
Can you tell me if something wrong happen about this.
Thanks