


Place 'while' in a do-while loop on a new line Place 'catch' and similar keywords on a new line Name: cpp_new_line_close_brace_same_line_empty_function.Name: cpp_new_line_close_brace_same_line_empty_typeįor empty function bodies, move closing braces to the same line as opening braces.Name: cpp_new_line_scope_braces_on_separate_linesįor empty types, move closing braces to the same line as opening braces.Name: cpp_new_line_before_open_brace_lambda.Name: cpp_new_line_before_open_brace_block.Position of open braces for control blocks Name: cpp_new_line_before_open_brace_function.Name: cpp_new_line_before_open_brace_type.ignore - Don't automatically reposition.same_line - Keep on the same line, but add a space before.Name: cpp_new_line_before_open_brace_namespace.leftmost_column - Move to the leftmost column.Name: cpp_indent_lambda_braces_when_parameter.Indent braces of lambdas used as parameters Name: cpp_indent_case_contents_when_block.Name: cpp_indent_preserve_within_parentheses.In existing code, do not use the setting for alignment of new lines within parentheses align_to_parenthesis - Align contents to opening parenthesis.Within parentheses, align new lines when I type them statement_begin - When a new line is typed, it's indented relatively to the beginning of the current statement.innermost_parenthesis - When a new line is typed, it's indented relatively to the innermost open parenthesis.outermost_parenthesis - When a new line is typed, it's indented relatively to the outermost open parenthesis.Name: cpp_indent_multi_line_relative_to.The rest of this document lists all the EditorConfig C++ formatting settings supported by Visual Studio and VS Code. Here's an example of what your EditorConfig file might look like: Ĭpp_indent_case_contents_when_block = trueĬpp_new_line_before_open_brace_namespace = same_line C++ formatting conventionsĬ++ formatting EditorConfig settings are prefixed with cpp_.

This means you can add EditorConfig files to your workspace to configure C++ formatting on a more granular level and enforce consistent code style for everyone contributing to the project. Both Visual Studio and Visual Studio Code have built-in EditorConfig support for each of the global Visual Studio C++ formatting settings, with the EditorConfig settings taking precedence. To set C++ formatting settings for a specific workspace, use clangformat or EditorConfig. The Visual Studio C++ formatter has a rich set of configurable settings that can be applied globally. Applies to: Visual Studio Visual Studio for Mac Visual Studio Code
