
#Visual studio format document settings code#
Tools > Options > Text Editor > C# > Code Style > Variable preferences > Prefer inlined variable declarationĪpply language/framework type preferences

When selected, inlines out variables where possible when Edit.FormatDocument is triggered.Ĭsharp_style_inlined_variable_declaration Tools > Options > Text Editor > C# > Code Style > 'var' preferences When selected, converts var to the explicit type, or vice versa, when Edit.FormatDocument is triggered. Tools > Options > Text Editor > C# > Code Style > Expression preferences > Use expression body for methods, constructors, etc. When selected, converts expression-bodied members to block bodies, or vice versa, when Edit.FormatDocument is triggered.Įxpression-bodied member EditorConfig options When selected, sorts accessibility modifiers when Edit.FormatDocument is triggered. When selected, adds missing accessibility modifiers when Edit.FormatDocument is triggered.ĭotnet_style_require_accessibility_modifiers Tools > Options > Text Editor > C# > Code Style > Code block preferences > Prefer braces When selected, adds or removes braces from single-line control statements when Edit.FormatDocument is triggered. Tools > Options > Text Editor > C# > Advanced > Place 'System' directives first when sorting usingsĪdd/remove braces for single-line control statements When selected, sorts using directives when Edit.FormatDocument is triggered. When selected, removes unnecessary using directives when Edit.FormatDocument is triggered. When selected, applies fixes for the rules specified below on the Edit.FormatDocument command. Perform addition code cleanup during formatting Tools > Options > Text Editor > C# > Formatting > The Format Document command always fixes formatting issues. LabelĬorresponding EditorConfig and Tools > Options rulesĪpply all C# formatting rules (indentation, wrapping, spacing) For more information about how these settings are applied, see Format Document command. These settings configure the Format Document command to perform additional code cleanup on a file. When selected, formats text that is pasted into the editor to fit the formatting options selected for the editor. When selected, formats text when Enter is pressed, to fit the formatting options selected for the editor. When selected, formats code blocks according to the formatting options selected for the editor as soon as you complete the code block. When selected, formats statements at completion according to the formatting options selected for the editor. When deselected, the format statement on and format block on } options are disabled. These settings affect when the code editor applies formatting options to code. Formatting (General) page General settings When you change a setting by selecting a radio button or check box, the preview window updates to show the effect of the new setting. The preview window shows an example of the selected option. To use the preview window, select a formatting option.

The Indentation, New Lines, Spacing, and Wrapping subpages each display a preview window at the bottom that shows the effect of each option.
