Text of code.visualstudio.com › docs › languages › javascript as Styx crawled it on Nov 18, 2026. The page may have changed since. Only its words are kept, without pictures or layout, and only the first part of a long page.

Open the live page

JavaScript in Visual Studio Code

AI agents: See llms.txt for documentation discovery and navigation. Documentation articles are also available as Markdown by appending .md to the article URL. Join VS Code at Microsoft Ignite or catch the sessions online. A year of VS Code, wrapped. Explore the highlights. JavaScript in Visual Studio Code View as Markdown Ask in VS Code Ask in VS Code Insiders Visual Studio Code includes built-in JavaScript IntelliSense, debugging, formatting, code navigation, refactorings, and many other advanced language features.

Most of these features just work out of the box, while some may require basic configuration to get the best experience. This page summarizes the JavaScript features that VS Code ships with. Extensions from the Visual Studio Marketplace can augment or change most of these built-in features. For a more in-depth guide on how these features work and can be configured, see Working with JavaScript . IntelliSense IntelliSense shows you intelligent code completion, hover information, and signature information so that you can write code more quickly and correctly.

Sorry, your browser doesn't support HTML 5 video. VS Code provides IntelliSense within your JavaScript projects; for many npm libraries such as React , lodash , and express ; and for other platforms such as node , serverless, or IoT. See Working with JavaScript for information about VS Code's JavaScript IntelliSense, how to configure it, and help troubleshooting common IntelliSense problems. JavaScript projects (jsconfig.json) A jsconfig.json file defines a JavaScript project in VS Code.

While jsconfig.json files are not required, you will want to create one in cases such as: If not all JavaScript files in your workspace should be considered part of a single JavaScript project. jsconfig.json files let you exclude some files from showing up in IntelliSense. To ensure that a subset of JavaScript files in your workspace is treated as a single project. This is useful if you are working with legacy code that uses implicit globals dependencies instead of imports for dependencies.

If your workspace contains more than one project context, such as front-end and back-end JavaScript code. For multi-project workspaces, create a jsconfig.json at the root folder of each project. You are using the TypeScript compiler to down-level compile JavaScript source code. To define a basic JavaScript project, add a jsconfig.json at the root of your workspace: { "compilerOptions" : { "module" : "CommonJS" , "target" : "ES6" }, "exclude" : [ "node_modules" ] } See Working with JavaScript for more advanced jsconfig.json configuration.

Tip To check if a JavaScript file is part of JavaScript project, just open the file in VS Code and run the JavaScript: Go to Project Configuration command. This command opens the jsconfig.json that references the JavaScript file. A notification is shown if the file is not part of any jsconfig.json project. Snippets VS Code includes basic JavaScript snippets that are suggested as you type; Sorry, your browser doesn't support HTML 5 video.

There are many extensions that provide additional snippets, including snippets for popular frameworks such as Redux or Angular. You can even define your own snippets . Tip To disable snippets suggestions, set editor.snippetSuggestions Open in VS Code Open in VS Code Insiders to "none" in your settings file. The editor.snippetSuggestions Open in VS Code Open in VS Code Insiders setting also lets you change where snippets appear in the suggestions: at the top ( "top" ), at the bottom ( "bottom" ), or inlined ordered alphabetically ( "inline" ).

The default is "inline" . JSDoc support VS Code understands many standard JSDoc annotations, and uses these annotations to provide rich IntelliSense . You can optionally even use the type information from JSDoc comments to type check your JavaScript . Sorry, your browser doesn't support HTML 5 video. Quickly create JSDoc comments for functions by typing /** before the function declaration, and select the JSDoc comment snippet suggestion: To disable JSDoc comment suggestions, disable the setting(js/ts.suggest.jsdoc.enabled) setting.

Hover Information Hover over a JavaScript symbol to quickly see its type information and relevant documentation. The ⌘K ⌘I (Windows, Linux Ctrl+K Ctrl+I ) keyboard shortcut shows this hover information at the current cursor position. Signature Help As you write JavaScript function calls, VS Code shows information about the function signature and highlights the parameter that you are currently completing: Signature help is shown automatically when you type a ( or , within a function call.

Press ⇧⌘Space (Windows, Linux Ctrl+Shift+Space ) to manually trigger signature help. Auto imports Automatic imports speed up coding by suggesting available variables throughout your project and its dependencies. When you select one of these suggestions, VS Code automatically adds an import for it to the top of the file. Just start typing to see suggestions for all available JavaScript symbols in your current project.

Auto import suggestions show where they will be imported from: If you choose one of these auto import suggestions, VS Code adds an import for it. In this example, VS Code adds an import for Button from material-ui to the top of the file: To disable auto imports, set "js/ts.suggest.autoImports" to false . Tip VS Code tries to infer the best import style to use. You can explicitly configure the preferred quote style and path style for imports added to your code with the setting(js/ts.preferences.quoteStyle) and setting(js/ts.preferences.importModuleSpecifier) settings.

Add imports on paste When you copy and paste code between editors, VS Code can automatically add imports when the code is pasted. When you paste code that contains an undefined symbol, a paste control is shown that lets you choose between pasting as plain text or to add imports. This feature is enabled by default, but you can disable it by toggling the setting(js/ts.updateImportsOnPaste.enabled) setting. You can make paste with imports the default behavior, without showing the paste control, by configuring the editor.pasteAs.preferences Open in VS Code Open in VS Code Insiders setting.

Include text.updateImports.jsts or text.updateImports to always add imports when pasting. Organize Imports The Organize Imports Source Action sorts the imports in a JavaScript file and removes any unused imports: Sorry, your browser doesn't support HTML 5 video. You can run Organize Imports from the Source Action context menu or with the ⇧⌥O (Windows, Linux Shift+Alt+O ) keyboard shortcut. Organize imports can also be done automatically when you save a JavaScript file by setting: "editor.codeActionsOnSave" : { "source.organizeImports" : "explicit" } Update imports on file move When you move or rename a file that is imported by other files in your JavaScript project, VS Code can automatically update all import paths that reference the moved file: Sorry, your browser doesn't support HTML 5 video.

The setting(js/ts.updateImportsOnFileMove.enabled) setting controls this behavior. Valid settings values are: "prompt" - The default. Asks if paths should be updated for each file move. "always" - Always automatically update paths. "never" - Do not update paths automatically and do not prompt. Formatting VS Code's built-in JavaScript formatter provides basic code formatting with reasonable defaults. The js/ts.format.* settings configure the built-in formatter.

Or, if the built-in formatter is getting in the way, set "js/ts.format.enable" to false to disable it. For more specialized code formatting styles, try installing one of the JavaScript formatting extensions from the Marketplace . JSX and auto closing tags All of VS Code's JavaScript features also work with JSX : You can use JSX syntax in both normal *.js files and in *.jsx files. VS Code also includes JSX-specific features such as autoclosing of JSX tags: Sorry, your browser doesn't su

The rest of this page is on the live site.