JetBrains Rider 2022.2 Help

EditorConfig properties for C++: Line breaks and Wrapping

General

Line feed at end of file

Property names:

insert_final_newline, [resharper_]cpp_insert_final_newline

Possible values:

true | false

Place on new line

Place 'else' on new line after compound statement

Property names:

[resharper_]cpp_new_line_before_else, [resharper_]new_line_before_else

Possible values:

true | false

Examples:

true

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

false

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

Place 'while' on new line after compound statement

Property names:

[resharper_]cpp_new_line_before_while, [resharper_]new_line_before_while

Possible values:

true | false

Examples:

true

do { foo(); } while (true);

false

do { foo(); } while (true);

Place 'catch' on new line after compound statement

Property names:

[resharper_]cpp_new_line_before_catch, [resharper_]new_line_before_catch

Possible values:

true | false

Examples:

true

try { foo(); } catch (...) { foo(); }

false

try { foo(); } catch (...) { foo(); }

Break line in single embedded statement

Property names:

[resharper_]cpp_simple_embedded_statement_style, [resharper_]simple_embedded_statement_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

if (true) foo(); else foo();

on_single_line

if (true) foo(); else foo();

line_break

if (true) foo(); else foo();

Break line in simple 'case' statement

Property names:

[resharper_]cpp_simple_case_statement_style, [resharper_]simple_case_statement_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

switch (a) { case b: break; case c: break; }

on_single_line

switch (a) { case b: break; case c: break; }

line_break

switch (a) { case b: break; case c: break; }

Break line after member function definition return type

Property names:

[resharper_]cpp_function_definition_return_type_style, [resharper_]function_definition_return_type_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

struct Boo { int* foo() { return 0; } char* bar() { return 0; } };

on_single_line

struct Boo { int* foo() { return 0; } char* bar() { return 0; } };

line_break

struct Boo { int* foo() { return 0; } char* bar() { return 0; } };

Break line after top-level function definition return type

Property names:

[resharper_]cpp_toplevel_function_definition_return_type_style, [resharper_]toplevel_function_definition_return_type_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; } char* bar() { return 0; }

on_single_line

int* foo() { return 0; } char* bar() { return 0; }

line_break

int* foo() { return 0; } char* bar() { return 0; }

Break line after member function declaration return type

Property names:

[resharper_]cpp_function_declaration_return_type_style, [resharper_]function_declaration_return_type_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

struct Boo { int* foo(); char* bar(); };

on_single_line

struct Boo { int* foo(); char* bar(); };

line_break

struct Boo { int* foo(); char* bar(); };

Break line after top-level function declaration return type

Property names:

[resharper_]cpp_toplevel_function_declaration_return_type_style, [resharper_]toplevel_function_declaration_return_type_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(); char* bar();

on_single_line

int* foo(); char* bar();

line_break

int* foo(); char* bar();

Break line after the template<...> of a template declaration

Property names:

[resharper_]cpp_break_template_declaration, [resharper_]break_template_declaration

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

template <class T> void foo(); template <class T> void bar();

on_single_line

template <class T> void foo(); template <class T> void bar();

line_break

template <class T> void foo(); template <class T> void bar();

Break line before the requires-clause

Property names:

[resharper_]cpp_line_break_before_requires_clause, [resharper_]line_break_before_requires_clause

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

template <bool T> requires T void foo(); template <bool T> requires T void bar();

on_single_line

template <bool T> requires T void foo(); template <bool T> requires T void bar();

line_break

template <bool T> requires T void foo(); template <bool T> requires T void bar();

Break line before colon in member initializer lists

Property names:

[resharper_]cpp_member_initializer_list_style, [resharper_]member_initializer_list_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

struct X { X(): x(0) {} X(int x) : x(x) {} int x; };

on_single_line

struct X { X(): x(0) {} X(int x) : x(x) {} int x; };

line_break

struct X { X(): x(0) {} X(int x) : x(x) {} int x; };

Break line after colon in member initializer lists

Property names:

[resharper_]cpp_line_break_after_colon_in_member_initializer_lists, [resharper_]line_break_after_colon_in_member_initializer_lists

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

struct X { X(): x(0) {} X(int x) : x(x) {} int x; };

on_single_line

struct X { X(): x(0) {} X(int x) : x(x) {} int x; };

line_break

struct X { X(): x(0) {} X(int x) : x(x) {} int x; };

Break line before comma in member initializer lists

Property names:

[resharper_]cpp_line_break_before_comma_in_member_initializer_lists, [resharper_]line_break_before_comma_in_member_initializer_lists

Possible values:

true | false

Examples:

true

struct MyStruct { MyStruct() : first(f), second(s) {} };

false

struct MyStruct { MyStruct() : first(f), second(s) {} };

Break line after comma in member initializer lists

Property names:

[resharper_]cpp_line_break_after_comma_in_member_initializer_lists, [resharper_]line_break_after_comma_in_member_initializer_lists

Possible values:

true | false

Examples:

true

struct MyStruct { MyStruct() : first(f), second(s) {} };

false

struct MyStruct { MyStruct() : first(f), second(s) {} };

Allow C++/CLI generic constraints on the same line

Property names:

[resharper_]cpp_place_type_constraints_on_same_line, [resharper_]place_type_constraints_on_same_line

Possible values:

true | false

Examples:

true

generic<class T>class C where T : IEnumerable{};

false

generic<class T>class C where T : IEnumerable{};

Line wrapping

Keep existing line breaks

Property names:

[resharper_]cpp_keep_user_linebreaks, [resharper_]keep_user_linebreaks

Possible values:

true | false

Examples:

Before formatting

After formatting, true

int var = condition ? SomeFunc1() : SomeFunc2();
int var = condition ? SomeFunc1() : SomeFunc2();

Before formatting

After formatting, false

int var = condition ? SomeFunc1() : SomeFunc2();
int var = condition ? SomeFunc1() : SomeFunc2();

Hard wrap at

Property names:

max_line_length, [resharper_]cpp_max_line_length

Possible values:

an integer

Prefer wrap before ','

Property names:

[resharper_]cpp_wrap_before_comma, [resharper_]wrap_before_comma

Possible values:

true | false

Examples:

true

CallMethod(arg1, arg2, arg3, arg4, arg5, arg6, arg7);

false

CallMethod(arg1, arg2, arg3, arg4, arg5, arg6, arg7);

Prefer wrap before ',' in base clause

Property names:

[resharper_]cpp_wrap_before_comma_in_base_clause, [resharper_]wrap_before_comma_in_base_clause

Possible values:

true | false

Examples:

true

class Derived : BaseClass, I1, I2, I3, I4 {}

false

class Derived : BaseClass, I1, I2, I3, I4 {}

Wrap ternary expression

Property names:

[resharper_]cpp_wrap_ternary_expr_style, [resharper_]wrap_ternary_expr_style

Possible values:

  • wrap_if_long: Simple wrap

  • chop_if_long: Chop if long or multiline

  • chop_always: Chop always

Examples:

wrap_if_long

myField = someCondition ? true : false;

chop_if_long

myField = someCondition ? true : false;

chop_always

myField = someCondition ? true : false;

Prefer wrap before '?' and ':' in ternary expressions

Property names:

[resharper_]cpp_wrap_before_ternary_opsigns, [resharper_]wrap_before_ternary_opsigns

Possible values:

true | false

Examples:

true

return hereGoesSomeBoolExpression ? returnThisIfTrue : returnThatIfFalse;

false

return hereGoesSomeBoolExpression ? returnThisIfTrue : returnThatIfFalse;

Prefer wrap before ':'

Property names:

[resharper_]cpp_wrap_before_colon, [resharper_]wrap_before_colon

Possible values:

true | false

Examples:

true

class Derived : BaseClass, I1, I2, I3, I4 {}

false

class Derived : BaseClass, I1, I2, I3, I4 {}

Prefer wrap before first C++/CLI generic constraint

Property names:

[resharper_]cpp_wrap_before_first_type_parameter_constraint, [resharper_]wrap_before_first_type_parameter_constraint

Possible values:

true | false

Examples:

true

generic<class T1, T2, T3>class C where T1: I1 where T2: I2 where T3 : ref class {};

false

generic<class T1, T2, T3>class C where T1: I1 where T2: I2 where T3 : ref class {};

Wrap multiple C++/CLI generic constraints

Property names:

[resharper_]cpp_wrap_multiple_type_parameter_constraints_style, [resharper_]wrap_multiple_type_parameter_constraints_style

Possible values:

  • wrap_if_long: Simple wrap

  • chop_if_long: Chop if long or multiline

  • chop_always: Chop always

Examples:

wrap_if_long

generic<class T1, T2, T3>class C where T1: I1 where T2: I2 where T3 : ref class {};

chop_if_long

generic<class T1, T2, T3>class C where T1: I1 where T2: I2 where T3 : ref class {};

chop_always

generic<class T1, T2, T3>class C where T1: I1 where T2: I2 where T3 : ref class {};

Wrap enum definition

Property names:

[resharper_]cpp_wrap_enumeration_style, [resharper_]wrap_enumeration_style

Possible values:

  • wrap_if_long: Simple wrap

  • chop_if_long: Chop if long or multiline

  • chop_always: Chop always

Examples:

wrap_if_long

enum { ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN };

chop_if_long

enum { ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN };

chop_always

enum { ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN };

Wrap braced initializer list

Property names:

[resharper_]cpp_wrap_braced_init_list_style, [resharper_]wrap_braced_init_list_style

Possible values:

  • wrap_if_long: Simple wrap

  • chop_if_long: Chop if long or multiline

  • chop_always: Chop always

Examples:

wrap_if_long

std::map<int, std::string> m = {{1, "a"}, {2, {'a', 'b', 'c'}}, {3, s1}, {4, s2}};

chop_if_long

std::map<int, std::string> m = {{1, "a"}, {2, {'a', 'b', 'c'}}, {3, s1}, {4, s2}};

chop_always

std::map<int, std::string> m = {{1, "a"}, {2, {'a', 'b', 'c'}}, {3, s1}, {4, s2}};

Wrap base classes list

Property names:

[resharper_]cpp_wrap_base_clause_style, [resharper_]wrap_base_clause_style

Possible values:

  • wrap_if_long: Simple wrap

  • chop_if_long: Chop if long or multiline

  • chop_always: Chop always

Examples:

wrap_if_long

class Derived : BaseClass, I1, I2, I3, I4 {}

chop_if_long

class Derived : BaseClass, I1, I2, I3, I4 {}

chop_always

class Derived : BaseClass, I1, I2, I3, I4 {}

Wrap constructor initializer

Property names:

[resharper_]cpp_wrap_ctor_initializer_style, [resharper_]wrap_ctor_initializer_style

Possible values:

  • wrap_if_long: Simple wrap

  • chop_if_long: Chop if long or multiline

  • chop_always: Chop always

Examples:

wrap_if_long

struct XXX { X(): x(0), y(0), z(0) {} XXX(int x, int y, int z) : x(x), y(y), z(z) {} int x; int y; int z; };

chop_if_long

struct XXX { X(): x(0), y(0), z(0) {} XXX(int x, int y, int z) : x(x), y(y), z(z) {} int x; int y; int z; };

chop_always

struct XXX { X(): x(0), y(0), z(0) {} XXX(int x, int y, int z) : x(x), y(y), z(z) {} int x; int y; int z; };

Wrap formal parameters

Property names:

[resharper_]cpp_wrap_parameters_style, [resharper_]wrap_parameters_style

Possible values:

  • wrap_if_long: Simple wrap

  • chop_if_long: Chop if long or multiline

  • chop_always: Chop always

Examples:

wrap_if_long

void SomeMethod(int p1, int p2, int p3, int p4) {}

chop_if_long

void SomeMethod(int p1, int p2, int p3, int p4) {}

chop_always

void SomeMethod(int p1, int p2, int p3, int p4) {}

Prefer wrap before '(' in declaration

Property names:

[resharper_]cpp_wrap_before_declaration_lpar, [resharper_]wrap_before_declaration_lpar

Possible values:

true | false

Examples:

true

void SomeMethod(int p1, int p2, int p3, int p4) {}

false

void SomeMethod(int p1, int p2, int p3, int p4) {}

Prefer wrap after '(' in declaration

Property names:

[resharper_]cpp_wrap_after_declaration_lpar, [resharper_]wrap_after_declaration_lpar

Possible values:

true | false

Examples:

true

void SomeMethod(int p1, int p2, int p3, int p4) {}

false

void SomeMethod(int p1, int p2, int p3, int p4) {}

Prefer wrap before ')' in declaration

Property names:

[resharper_]cpp_wrap_before_declaration_rpar, [resharper_]wrap_before_declaration_rpar

Possible values:

true | false

Examples:

true

void SomeMethod(int p1, int p2, int p3, int p4) {}

false

void SomeMethod(int p1, int p2, int p3, int p4) {}

Wrap invocation arguments

Property names:

[resharper_]cpp_wrap_arguments_style, [resharper_]wrap_arguments_style

Possible values:

  • wrap_if_long: Simple wrap

  • chop_if_long: Chop if long or multiline

  • chop_always: Chop always

Examples:

wrap_if_long

CallMethod(arg1, arg2, arg3, arg4, arg5);

chop_if_long

CallMethod(arg1, arg2, arg3, arg4, arg5);

chop_always

CallMethod(arg1, arg2, arg3, arg4, arg5);

Prefer wrap before '(' in invocation

Property names:

[resharper_]cpp_wrap_before_invocation_lpar, [resharper_]wrap_before_invocation_lpar

Possible values:

true | false

Examples:

true

CallMethod(arg1, arg2, arg3, arg4, arg5);

false

CallMethod(arg1, arg2, arg3, arg4, arg5);

Prefer wrap after '(' in invocation

Property names:

[resharper_]cpp_wrap_after_invocation_lpar, [resharper_]wrap_after_invocation_lpar

Possible values:

true | false

Examples:

true

CallMethod(arg1, arg2, arg3, arg4, arg5);

false

CallMethod(arg1, arg2, arg3, arg4, arg5);

Prefer wrap before ')' in invocation

Property names:

[resharper_]cpp_wrap_before_invocation_rpar, [resharper_]wrap_before_invocation_rpar

Possible values:

true | false

Examples:

true

CallMethod(arg1, arg2, arg3, arg4, arg5);

false

CallMethod(arg1, arg2, arg3, arg4, arg5);

Prefer wrap after '{' in initializer lists

Property names:

[resharper_]cpp_wrap_after_expression_lbrace, [resharper_]wrap_after_expression_lbrace

Possible values:

true | false

Examples:

true

map<int, string> m = {{1, "a"}, {2, {'a', 'b', 'c'}}, {3, s1}, {4, s2}};

false

map<int, string> m = {{1, "a"}, {2, {'a', 'b', 'c'}}, {3, s1}, {4, s2}};

Prefer wrap before '}' in initializer lists

Property names:

[resharper_]cpp_wrap_before_expression_rbrace, [resharper_]wrap_before_expression_rbrace

Possible values:

true | false

Examples:

true

map<int, string> m = {{1, "a"}, {2, {'a', 'b', 'c'}}, {3, s1}, {4, s2}};

false

map<int, string> m = {{1, "a"}, {2, {'a', 'b', 'c'}}, {3, s1}, {4, s2}};
Last modified: 09 August 2022