Skip to content

IntelliSense and Editing

Paul van Brenk edited this page Dec 12, 2017 · 23 revisions

🎵Note: This documentation is outdated at this point, especially when using the Node tools in Visual Studio 2017. We're working on update docs, and will redirect you to those when they're ready.

NTVS IntelliSense provides helpful info about code to help you quickly understand and write Node.js programs.

IntelliSense in NTVS 1.1

NTVS exposes three helpful sources of IntelliSense while writing your program: completions, signature help, and quick info.

NTVS 1.1 uses a static analysis engine by default. This offers a rich and comprehensive IntelliSense experience for ECMAScript code, but also can use a lot of memory and cpu. If you are running into performance problems with NTVS or are working with ES6 code, try upgrading to NTVS 1.2+ or try enabling ES6 IntelliSense Preview on NTVS 1.1.

Completions

Completions are a list of words shown while typing and can be used to quickly complete names or expressions. The words shown are based on the context and are filtered to avoid showing options that are incorrect or distracting. Completions can be shown at any time by pressing Ctrl+J or Ctrl+Space, or may be triggered automatically.

Simple completion

(To prevent completions from appearing automatically, disable Tools -> Options -> Text Editor -> Node.js -> General -> Auto list members. You can still manually show completions by pressing Ctrl+J or Ctrl+Space.)

With a list open, you can search for the completion you want using the arrow keys, the mouse, or by continuing to type. As you type more letters, the list is further filtered to show likely completions.

Member completions are shown automatically when you type a period after a variable or value, and will display the members of the potential values.

The 'require' argument completion is shown automatically after typing require followed by an opening parenthesis, and displays the list of available modules.

require('') completion

By default, only the core Node.js modules and file modules from node_modules are shown in the list. To show modules in the project itself, type period after the opening parenthesis.

require('./') completion

Signature help

Signature help is displayed when writing a function call, and includes any documentation and parameter information that is available. Signature help appears automatically after typing the '(' in a function call, and can be displayed at any time by pressing Ctrl+Shift+Space inside a function call.

Signature help

(To stop automatically showing signature help, disable Tools -> Options -> Text Editor -> Node.js -> General -> Parameter information. You can still manually display signature help by pressing Ctrl+Shift+Space.)

Settings

The new analysis engine introduced in NTVS Beta 2 should do a better job of providing completions in larger projects and should be faster to provide those completions.

You can change the amount of CPU time and memory used or disable it completely in Tools -> Options -> Text Editor -> Node.js -> IntelliSense.

IntelliSense in NTVS 1.2

NTVS 1.2 offers the same completions, signature help, and quick info as NTVS 1.1, but uses the new Typescript-based "Salsa" analysis engine by default. Salsa offers much better performance and supports ES6 language features.

IntelliSense Modes

NTSV 1.2 has two primary IntelliSense modes: ECMAScript 6 and ECMAScript 5. You can switch between these modes in Tools -> Options and then Text Editor -> Node.js -> IntelliSense

ECMAScript 6 is the modern IntelliSense experience. It is recommended for all users (including ES5), as it supports ES6 code and is significantly more performant.

NTVS 1.2 IntelliSense modes

ECMAScript 5 is the legacy IntelliSense experience, offering the same features as NTVS 1.1 and 1.0. This will use our old static analysis engine by default. We strongly recommend against using this mode, unless you are coming from NTVS 1.1 and ECMAScript 6 does not support a feature you rely on.

NTVS 1.2 IntelliSense modes

Automatic Typings Acquisition

EcmaScript 6 IntelliSense Mode takes advantage of type definition files to provide better and more performant IntelliSense for the most popular Node.js frameworks, such as Commander, Express, jQuery and Knockout.

Whenever you require a new npm package, the associated "typings" will be automatically downloaded to your project. image

For instance, if you npm install the express module, the express.d.ts will be automatically downloaded from DefinitelyTyped and included in your project, and you'll be able to see the relevant completions next time you 'require' the module. image

See this page for more info about automatic typings acquisition.