Options, Text Editor, JavaScript, Formatting

 

For the latest documentation on Visual Studio 2017, see Visual Studio 2017 Documentation.

For the latest documentation on Visual Studio 2017, see Options, Text Editor, JavaScript, Formatting on docs.microsoft.com. 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, and Formatting.

System_CAPS_ICON_note.jpg Note

Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Personalizing the IDE.

These options determine when formatting occurs in Source view.

OptionDescription
Format completed line on EnterWhen 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 completed block on }When this option is selected, the Code Editor automatically formats the line when you choose the closing brace key.
Format on pasteWhen 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.

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

OptionDescription
Place open brace on new line for functionsWhen 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 blocksWhen 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.

These options determine how spaces are inserted in Sourceview.

OptionDescription
Insert space after comma delimiterWhen this option is selected, the Code Editor adds a space after comma delimiters.
Insert space after semicolon in 'for' statementWhen 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 operatorsWhen this option is selected, the Code Editor adds a space before and after binary operators (for example, +, -, &&, ||).
Insert space after keywords in control flow statementsWhen 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 parenthesisWhen 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.

General, Environment, Options Dialog Box

Show: