Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
title description ms.date ms.technology ms.topic f1_keywords ms.assetid author ms.author manager ms.workload
Options, Text Editor, JavaScript, Formatting
Learn how to use the Formatting page of the Options dialog box to set options for formatting code in the Code Editor.
10/29/2018
vs-javascript
reference
VS.ToolsOptionsPages.Text_Editor.JavaScript.Formatting.Spacing
VS.ToolsOptionsPages.Text_Editor.JavaScript.Formatting.General
VS.ToolsOptionsPages.Text_Editor.JavaScript.Formatting.New_Lines
VS.ToolsOptionsPages.Text_Editor.TypeScript.Formatting.Spacing
VS.ToolsOptionsPages.Text_Editor.TypeScript.Formatting.General
VS.ToolsOptionsPages.Text_Editor.TypeScript.Formatting.New_Lines
28a0aef1-9353-4d94-95a5-54b42e15c0dc
mikejo5000
mikejo
jmartens
multiple

Options dialog box: Text Editor > JavaScript > Formatting

[!INCLUDE Visual Studio]

Use the Formatting page of the Options dialog box to set options for formatting code in the Code Editor. To access this page, on the menu bar, choose Tools > Options, and then expand Text Editor > JavaScript/TypeScript > Formatting.

[!INCLUDEnote_settings_general]

Automatic Formatting

These options determine when formatting occurs in Source view.

UIElement List

Option Description
Format completed line on Enter When this option is selected, the Code Editor automatically formats the line when you choose the Enter key.
Format completed statement on ; When this option is selected, the Code Editor automatically formats the line when you choose the semicolon key.
Format opened block on { When this option is selected, the Code Editor automatically formats the line when you choose the opening brace key.
Format completed block on } When this option is selected, the Code Editor automatically formats the line when you choose the closing brace key.
Format on paste When this option is selected, the Code Editor reformats code when you paste it into the editor. The editor uses the currently defined formatting rules. If this option is not selected, the editor uses the original formatting of the pasted-in code.

New Lines

These options determine whether the Code Editor puts an open brace for functions and control blocks on a new line.

UIElement list

Option Description
Place open brace on new line for functions When this option is selected, the Code Editor moves the open brace associated with a function to a new line.
Place open brace on new line for control blocks When this option is selected, the Code Editor moves the open brace associated with a control block (for example, if and while control blocks) to a new line.

Spacing

These options determine how spaces are inserted in Source view.

UIElement list

Option Description
Insert space after comma delimiter When this option is selected, the Code Editor adds a space after comma delimiters.
Insert space after semicolon in 'for' statements When this option is selected, the Code Editor adds a space after each semicolon in the first line of a for loop.
Insert space before and after binary operators When this option is selected, the Code Editor adds a space before and after binary operators (for example, +, -, &&, ||).
Insert space after keywords in control flow statements When this option is selected, the Code Editor adds a space after JavaScript keywords in control flow statements.
Insert space after function keyword for anonymous functions When this option is selected, the Code Editor adds a space after the function keyword for anonymous functions.
Insert space after opening and before closing non-empty parenthesis When this option is selected, the Code Editor adds a space after the opening parenthesis and before the closing parenthesis if non-empty characters are present within the parentheses.

See also