Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The Visual Studio Code 0.10.10 release features a fiesta of language improvements, including...
Languages - JavaScript
The Salsa JavaScript language service was available as preview in January and it is now the default language service for JavaScript in the February update.
Improvements
The JSDoc comment format is now understood and used to improve IntelliSense proposals and parameter hints:
You now get IntelliSense proposals for properties in 'ECMAScript 3 style classes':
IntelliSense offers both inferred proposals and the global identifiers of the project. The inferred symbols are presented first, followed by the global identifiers (with the document icon), as you can see in the image above.
The commonjs support has been improved as well:
There is now support for JSX/React:
Tip: To get IntelliSense for React/JSX, install the typings for
react-globalby runningtsd install react-globalortypings install --ambient react-globalfrom the terminal.
Tip: When you use eslint for linting (see below) and you used
eslint --initto create an eslint configuration and you answeredyesto "Do you use React?", then the settingexperimentalObjectRestSpreadis enabled. Support for ObjectRestSpread is not yet provided by Salsa but it is on the roadmap (see #2103).
There is now support for React Native:
Tip: To get IntelliSense for React Native, install the typings for
react-nativeby runningtsd install react-nativeortypings install --ambient react-nativefrom the terminal. Or even better... if you also want debugging support then install the preview of the React Native extension.
Tip: There is a known issue in that Salsa Doesn't Provide IntelliSense When Using Import Statements.
It is now possible to have mixed TypeScript and JavaScript projects. To enable JavaScript inside a TypeScript project, you can set the allowJs property to true in the tsconfig.json.
Tip: The
tsccompiler does not detect the presence of ajsconfig.jsonfile automatically. Use the–pargument to maketscuse yourjsconfig.jsonfile, e.g.tsc -p jsconfig.json.
Finally, the TypeScript compiler tsc can down-level compile JavaScript files from ES6 to another language level.
Migration Notes
The following sections describe a few of VS Code's features that have changed with the move to Salsa and provide information about maintaining previous behaviors.
Linters
Previously the JavaScript language support provided some linting options enabled by the javascript.validate.lint.* settings. With jshint and eslint, there are powerful linters for JavaScript available. Also, there are now extensions for VS Code available that integrate these linters. Therefore, we have decided to deprecate the built-in linter and Salsa now reports syntax errors only. We strongly recommend that you install and configure a JavaScript linter if your project hasn't done so already.
In particular, the previous JavaScript infrastructure provided an implicit lint rule which warned about undeclared variables unless they are mentioned in a /*global*/ comment block. This rule is no longer active and needs to be configured in your linter of choice.
Here are the steps to set up eslint:
npm install eslintto installeslintinto your workspace ornpm install -g eslintto install it globally.- install the VS Code eslint extension.
- use
eslint --initto create an initial eslint configuration by answering questions or by picking a popular configuration.
Tip: If you use JSON as the format of the eslint configuration file, then VS Code can provide you with IntelliSense when you edit the .eslintrc.json file.
This .eslintrc.json corresponds roughly to the lint settings of the old JavaScript infrastructure.
Changes in jsconfig.json
exclude lists
The previous JavaScript language service had a built-in list for folders that should be excluded from the project context. This list included the folders: node_modules, bower_components, jspm_packages, tmp, and temp. This implicit behavior has changed in favor of an explicit list defined by the user. Therefore if you use...
nodeexclude thenode_modulesfolderbowerexclude thebower_componentsfolderemberexclude thetmpandtempfolderjspmexclude thejspm_packagesfolderwebpackthen exclude the output folder, e.g.,dist.
Tip: After editing the jsconfig.json, do not forget to run the Reload JavaScript command to ensure that everything is up to date.
Defaults
If you do not have a jsconfig.json in your workspace then the following defaults are used:
- the
excludelist includes thenode_modulesfolder and the folder defined by theoutattribute.
What has not changed, but that you should be aware of, is that if you have no jsconfig.json defined to mark the root of your project, then each JavaScript file is considered an island by Salsa.
js-is-jsx etension deprecation
The js-is-jsx extension is no longer needed since Salsa gives you coloring for JSX constructs inside .js files out of the box. We recommend you uninstall this extension.
No longer supported
Salsa undoubtedly provides a much better experience writing JavaScript applications in VS Code. By moving to Salsa, we give up a few features previously available with our old JavaScript language service:
- The source language level is now always ECMAScript 6. Previously, there was support to define a lower level using the
targetattribute insidejsconfig.json. This support has been removed and thetargetattribute is now only used bytscto define the target version when a JavaScript file is compiled to a lower ECMAScript version. - The previous JavaScript infrastructure attempted to resolve references for
AMDmodules. This hasn't worked in all cases and support forAMDto resolve references across files is currently no longer supported. - There is no longer support for IntelliSense in
scriptsections inside HTML documents. - The
javascript.validate.*settings are no longer supported and are ignored (see above). - The previous JavaScript infrastructure provided quick fixes to add an undefined variable as a global and to fetch a type definition from definitely typed. These quick fixes are no longer available.
- A file without a .js suffix that VS Code identifies as a JavaScript file is now treated as a .ts file and you get unexpected type errors (#issue 7291).
Languages - TypeScript
VS Code now ships with the latest TypeScript 1.8.2 version.
Languages - C#
C# language support is now an optional install from the Marketplace. You can install it from within VS Code by searching for 'C#':
Or if you already have a project with C# files, VS Code will prompt you to install the extension as soon as you open a C# file.
Check out all the new features and update to Visual Studio Code v0.10.10:
https://code.visualstudio.com/updates
You're looking visual and studious,
- Ninja Ed
Comments
- Anonymous
March 18, 2016
"C# language support is now an optional install from the Marketplace. "What sense did moving this to optional even make??- Anonymous
April 01, 2016
Dev,I think it just means you can search for it and install it directly in the Marketplace.Thanks!
- Anonymous
- Anonymous
May 08, 2016
FEAUTRED BLOG POSTS:=======================Ed's Book - Learn How to Program with Small Basic:https://blogs.msdn.microsoft.com/user_ed/2016/03/03/early-access-book-learn-to-program-with-small-basic/=======================Computers Today (part 1 of 6):http://blogs.msdn.com/b/user_ed/archive/2016/01/16/computers-today.aspx=======================Girls in computer programming... why it matters!!!http://blogs.msdn.com/b/user_ed/archive/2016/01/23/cs-spotlight-girls-in-computer-programming-why-it-matters.aspx=======================Why should I teach Java in Visual Studio Code?http://blogs.msdn.com/b/user_ed/archive/2016/02/05/why-should-i-teach-java-out-of-visual-studio-code-instead-of-out-of-eclipse-or-netbeans.aspx