Previewing Salsa – the New JavaScript Language Service in Visual Studio "15"

The new JavaScript language service, codenamed “Salsa”, is now available in Visual Studio “15” Preview. Language services are responsible for providing syntax highlighting, completion lists, signature help, and other tooling features for a specific language inside the IDE. Salsa delivers many improvements over the existing JavaScript language service such as improved module support, full ES6/ES7 syntax coverage, and JSX support.

Why a new language service?

Until now, JavaScript editing in Visual Studio used an execution model for the language service. Essentially, as you typed, a JavaScript engine constantly executed your code to provide “runtime-like” accuracy in completion lists, signature help, and other tooling features. The execution engine was great for handling the more dynamic aspects of the language, however, it also introduced significant complexity and inconsistency. For example, the execution engine is subject to timeouts from long running code such as nested loops and http requests. In these scenarios, the language service was unable to provide any IntelliSense support.

Salsa is powered by the same static analysis that provides type inference in TypeScript. By basing the new language service on static analysis we hope to accomplish a number of goals. First, static analysis provides a consistent experience for JavaScript across all Visual Studio setups by eliminating runtime bailouts. Second, JavaScript editing experiences can benefit from existing TypeScript definition to provide richer IntelliSense. Third, JavaScript inherits support for features from ES2015, ES2016 and beyond that currently exist in TypeScript. Finally, we can be more agile and add new features more often by unifying our code bases.

Enabling Salsa in Visual Studio “15” Preview

Salsa is not enabled by default because it is a preview, but please try it out and let us know what you think. To enable Salsa in Visual Studio “15” Preview, save the below snippet as a local file named salsa.reg, run it to update the registry, and then restart Visual Studio. (Do the same with value 00000000 instead of 00000001 to disable at any point).

Windows Registry Editor Version 5.00

New features provided by Salsa

ES6 and commonjs modules

Salsa understands the ES6 and commonjs module formats (both top user voice requests) and can provide IntelliSense across modules.

Assuming the file math-util.js exists:

* Returns square of a number.
* @param {number} x Number to square.
export function square(x) {
return x * x;

Imports in other files are resolved and IntelliSense is provided.

Imports resolved and IntelliSense provided

JSX support

Salsa adds rich support for the JSX syntax including colorizing and completions inside JSX elements. This provides an excellent editing experience when working with modern frameworks that utilize JSX such as React.

JSX Support

Types from TypeScript definitions

Because the core of the new language service is also used to power TypeScript, JavaScript editing in Visual Studio can now benefit from the rich type information that the TypeScript community has created for popular JavaScript libraries and frameworks. This type of information is stored in TypeScript definition files, or.d.ts files, and can be consumed by Salsa to provide improved JavaScript IntelliSense.

Types from TypeScript Definitions

By default, the Salsa language service will try to detect which JavaScript libraries are in use and automatically download and reference the corresponding .d.ts file that describes the specific library. For more information on this feature, check out the wiki on GitHub.

Planned Features

One of the features in Salsa that we are actively working on is to improve the automatic type acquisition by the language service. Currently, the JavaScript language service that is shipped as a part of the preview relies on a third party library to search DefinitelyTyped for .d.ts files and we realize that the experience with the same is not optimal. To remove the third party dependency and make the end-to-end experience smoother, we are working on building the type acquisition capability directly into the language service itself. We are also working on improving coverage of the JSDoc spec to include @constructor and @typedef. You can see a full list of issues we are working through on GitHub.

Notable Changes

As Salsa is a completely new language service, there are a few changes in functionality that I would like to call out. One such change is that VSDoc format for comments will no longer light up the language service in favor of the JSDoc format, which is easier to author and becoming universally understood. Another key difference is that while the old language service supported an extensibility model that allowed custom extensions to be developed for specific 3rd party JavaScript libraries, Salsa no longer supports these extensions in favor of TypeScript definition files which encourage community collaboration and are easier to keep up-to-date.

Send us feedback!

For more in depth usage information, feature explanations, and details on specific behaviors in Salsa, check out our wiki page Using the Salsa Preview in Visual Studio 15 Preview.

The end goal of Salsa is to provide a JavaScript editing experience that is reliable and delightful, but it is still very much a work in progress. So please download Visual Studio “15” Preview, give Salsa a spin, and tell us what you think by commenting on the Salsa Feedback issue on GitHub!

Bowden Kelly, Program Manager, VS Client

Bowden works on the JavaScript editing experience with a focus on helping developers be more productive in Visual Studio. Outside of work he enjoys playing soccer, teaching the basics of programming, and attempting to be a triathlete.