ReSharper 2024.2 Help

EditorConfig properties for C++: Braces Layout

Braces layout

Namespace declaration

Property names:

[resharper_]cpp_namespace_declaration_braces, [resharper_]cpp_brace_style, [resharper_]namespace_declaration_braces, [resharper_]brace_style

Possible values:

  • end_of_line: At the end of line (K&R style)

  • end_of_line_no_space: At the end of line (no space)

  • next_line: At next line (BSD style)

  • next_line_shifted: At next line indented (Whitesmiths style)

  • next_line_shifted_2: At next line indented 2 (GNU style)

Examples:

end_of_line

namespace ns { void a(); }

end_of_line_no_space

namespace ns{ void a(); }

next_line

namespace ns { void a(); }

next_line_shifted

namespace ns { void a(); }

next_line_shifted_2

namespace ns { void a(); }

Linkage specifications

Property names:

[resharper_]cpp_linkage_specification_braces, [resharper_]cpp_brace_style, [resharper_]linkage_specification_braces, [resharper_]brace_style

Possible values:

  • end_of_line: At the end of line (K&R style)

  • end_of_line_no_space: At the end of line (no space)

  • next_line: At next line (BSD style)

  • next_line_shifted: At next line indented (Whitesmiths style)

  • next_line_shifted_2: At next line indented 2 (GNU style)

Examples:

end_of_line

extern "C++" { void a(); }

end_of_line_no_space

extern "C++"{ void a(); }

next_line

extern "C++" { void a(); }

next_line_shifted

extern "C++" { void a(); }

next_line_shifted_2

extern "C++" { void a(); }

Export declarations

Property names:

[resharper_]cpp_export_declaration_braces, [resharper_]cpp_brace_style, [resharper_]export_declaration_braces, [resharper_]brace_style

Possible values:

  • end_of_line: At the end of line (K&R style)

  • end_of_line_no_space: At the end of line (no space)

  • next_line: At next line (BSD style)

  • next_line_shifted: At next line indented (Whitesmiths style)

  • next_line_shifted_2: At next line indented 2 (GNU style)

Examples:

end_of_line

export { void a(); }

end_of_line_no_space

export{ void a(); }

next_line

export { void a(); }

next_line_shifted

export { void a(); }

next_line_shifted_2

export { void a(); }

Type declaration

Property names:

[resharper_]cpp_type_declaration_braces, [resharper_]cpp_brace_style, [resharper_]type_declaration_braces, [resharper_]brace_style

Possible values:

  • end_of_line: At the end of line (K&R style)

  • end_of_line_no_space: At the end of line (no space)

  • next_line: At next line (BSD style)

  • next_line_shifted: At next line indented (Whitesmiths style)

  • next_line_shifted_2: At next line indented 2 (GNU style)

Examples:

end_of_line

class C { public: void a(); };

end_of_line_no_space

class C{ public: void a(); };

next_line

class C { public: void a(); };

next_line_shifted

class C { public: void a(); };

next_line_shifted_2

class C { public: void a(); };

Place namespace definitions on the same line

Property names:

[resharper_]cpp_place_namespace_definitions_on_same_line, [resharper_]place_namespace_definitions_on_same_line

Possible values:

true | false

Examples:

true

namespace A { namespace B { void a(); }}

false

namespace A { namespace B { void a(); } }

Function declaration

Property names:

[resharper_]cpp_invocable_declaration_braces, [resharper_]cpp_brace_style, [resharper_]invocable_declaration_braces, [resharper_]brace_style

Possible values:

  • end_of_line: At the end of line (K&R style)

  • end_of_line_no_space: At the end of line (no space)

  • next_line: At next line (BSD style)

  • next_line_shifted: At next line indented (Whitesmiths style)

  • next_line_shifted_2: At next line indented 2 (GNU style)

Examples:

end_of_line

void a() { b(); }

end_of_line_no_space

void a(){ b(); }

next_line

void a() { b(); }

next_line_shifted

void a() { b(); }

next_line_shifted_2

void a() { b(); }

Lambda expression

Property names:

[resharper_]cpp_anonymous_method_declaration_braces, [resharper_]cpp_brace_style, [resharper_]anonymous_method_declaration_braces, [resharper_]brace_style

Possible values:

  • end_of_line: At the end of line (K&R style)

  • end_of_line_no_space: At the end of line (no space)

  • next_line: At next line (BSD style)

  • next_line_shifted: At next line indented (Whitesmiths style)

  • next_line_shifted_2: At next line indented 2 (GNU style)

Examples:

end_of_line

auto a = []() { int x = 0; return x; };

end_of_line_no_space

auto a = [](){ int x = 0; return x; };

next_line

auto a = []() { int x = 0; return x; };

next_line_shifted

auto a = []() { int x = 0; return x; };

next_line_shifted_2

auto a = []() { int x = 0; return x; };

Block under 'case' label

Property names:

[resharper_]cpp_case_block_braces, [resharper_]cpp_brace_style, [resharper_]case_block_braces, [resharper_]brace_style

Possible values:

  • end_of_line: At the end of line (K&R style)

  • end_of_line_no_space: At the end of line (no space)

  • next_line: At next line (BSD style)

  • next_line_shifted: At next line indented (Whitesmiths style)

  • next_line_shifted_2: At next line indented 2 (GNU style)

Examples:

end_of_line

switch (expression) { case 0: { foo(); break; } }

end_of_line_no_space

switch (expression) { case 0: { foo(); break; } }

next_line

switch (expression) { case 0: { foo(); break; } }

next_line_shifted

switch (expression) { case 0: { foo(); break; } }

next_line_shifted_2

switch (expression) { case 0: { foo(); break; } }

Requires expressions

Property names:

[resharper_]cpp_requires_expression_braces, [resharper_]requires_expression_braces

Possible values:

  • end_of_line: At the end of line (K&R style)

  • end_of_line_no_space: At the end of line (no space)

  • next_line: At next line (BSD style)

  • next_line_shifted: At next line indented (Whitesmiths style)

  • next_line_shifted_2: At next line indented 2 (GNU style)

Examples:

end_of_line

template <typename T> concept C = requires { typename T::inner1; typename T::inner2; };

end_of_line_no_space

template <typename T> concept C = requires{ typename T::inner1; typename T::inner2; };

next_line

template <typename T> concept C = requires { typename T::inner1; typename T::inner2; };

next_line_shifted

template <typename T> concept C = requires { typename T::inner1; typename T::inner2; };

next_line_shifted_2

template <typename T> concept C = requires { typename T::inner1; typename T::inner2; };

Other statements and blocks

Property names:

[resharper_]cpp_other_braces, [resharper_]cpp_brace_style, [resharper_]other_braces, [resharper_]brace_style

Possible values:

  • end_of_line: At the end of line (K&R style)

  • end_of_line_no_space: At the end of line (no space)

  • next_line: At next line (BSD style)

  • next_line_shifted: At next line indented (Whitesmiths style)

  • next_line_shifted_2: At next line indented 2 (GNU style)

Examples:

end_of_line

if (condition) { foo(); } else { foo(); }

end_of_line_no_space

if (condition){ foo(); } else{ foo(); }

next_line

if (condition) { foo(); } else { foo(); }

next_line_shifted

if (condition) { foo(); } else { foo(); }

next_line_shifted_2

if (condition) { foo(); } else { foo(); }

Other braces

Property names:

[resharper_]cpp_expression_braces, [resharper_]expression_braces

Possible values:

  • inside: Inside parenthesis (BSD/K&R style)

  • outside: Parenthesis and inside equally (Whitesmiths style)

  • outside_and_inside: Parenthesis 1x, inside 2x (GNU style)

  • none: No indent

Examples:

inside

int a[10] = { 1, 2, 3 };

outside

int a[10] = { 1, 2, 3 };

outside_and_inside

int a[10] = { 1, 2, 3 };

none

int a[10] = { 1, 2, 3 };

Empty braces formatting

Property names:

[resharper_]cpp_empty_block_style, [resharper_]empty_block_style

Possible values:

  • multiline: On different lines

  • together: Place braces together

  • together_same_line: Together on the same line

Examples:

multiline

class C { }; void foo() { for (;;) { } }

together

class C {}; void foo() { for (;;) {} }

together_same_line

class C {}; void foo() { for (;;) {} }

Keep simple compound statements in one line

Property names:

[resharper_]cpp_simple_block_style, [resharper_]simple_block_style

Possible values:

  • do_not_change: Do not change

  • on_single_line: Force put on single line

  • line_break: Force line breaks

Examples:

do_not_change

int foo() { return 0; }

on_single_line

int foo() { return 0; }

line_break

int foo() { return 0; }

Regular expression for macros starting a block

Property names:

[resharper_]cpp_macro_block_begin, [resharper_]macro_block_begin

Regular expression for macros ending a block

Property names:

[resharper_]cpp_macro_block_end, [resharper_]macro_block_end

Allow comment after '{'

Property names:

[resharper_]cpp_allow_comment_after_lbrace, [resharper_]allow_comment_after_lbrace

Possible values:

true | false

Examples:

true

if (condition) { // comment statement; }

false

if (condition) { // comment statement; }
Last modified: 26 May 2024