ReSharper 2017.3 Help

C++ - Line breaks and Wrapping

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:

  • line_break: Force line breaks
  • on_single_line: Force put on single line
  • do_not_change: Do not change

Examples:

line_break
if·(true) ··foo(); else ··foo();
on_single_line
if·(true)·foo(); else·foo();
do_not_change
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:

  • line_break: Force line breaks
  • on_single_line: Force put on single line
  • do_not_change: Do not change

Examples:

line_break
switch·(a) { case·b: ··break; case·c: ··break; }
on_single_line
switch·(a) { case·b:·break; case·c:·break; }
do_not_change
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:

  • line_break: Force line breaks
  • on_single_line: Force put on single line
  • do_not_change: Do not change

Examples:

line_break
struct·Boo { ··int* ··foo()·{·return·0;·} ··char* ··bar()·{·return·0;·} };
on_single_line
struct·Boo { ··int*·foo()·{·return·0;·} ··char*·bar()·{·return·0;·} };
do_not_change
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:

  • line_break: Force line breaks
  • on_single_line: Force put on single line
  • do_not_change: Do not change

Examples:

line_break
int* foo()·{·return·0;·} char* bar()·{·return·0;·}
on_single_line
int*·foo()·{·return·0;·} char*·bar()·{·return·0;·}
do_not_change
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:

  • line_break: Force line breaks
  • on_single_line: Force put on single line
  • do_not_change: Do not change

Examples:

line_break
struct·Boo { ··int* ··foo(); ··char* ··bar(); };
on_single_line
struct·Boo { ··int*·foo(); ··char*·bar(); };
do_not_change
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:

  • line_break: Force line breaks
  • on_single_line: Force put on single line
  • do_not_change: Do not change

Examples:

line_break
int* foo(); char* bar();
on_single_line
int*·foo(); char*·bar();
do_not_change
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:

  • line_break: Force line breaks
  • on_single_line: Force put on single line
  • do_not_change: Do not change

Examples:

line_break
template·<class·T> void·foo(); template·<class·T> void·bar();
on_single_line
template·<class·T>·void·foo(); template·<class·T>·void·bar();
do_not_change
template·<class·T> void·foo(); template·<class·T>·void·bar();

Break line before member initializer list

Property names:

[resharper_]cpp_member_initializer_list_style, [resharper_]member_initializer_list_style

Possible values:

  • line_break: Force line breaks
  • on_single_line: Force put on single line
  • do_not_change: Do not change

Examples:

line_break
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; };
do_not_change
struct·X { ··X():·x(0) ··{ ··} ··X(int·x) ····:·x(x) ··{ ··} ··int·x; };

Line break 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) ··{ ··} };

Line break 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) ··{ ··} };

Line Wrapping

Right margin (columns)

Property names:

cpp_max_line_length, 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);

Wrap ternary expression

Property names:

[resharper_]cpp_wrap_ternary_expr_style, [resharper_]wrap_ternary_expr_style

Possible values:

  • chop_always: Chop always
  • chop_if_long: Chop if long or multiline
  • wrap_if_long: Simple wrap

Examples:

chop_always
myField·=·someCondition ············?·true ············:·false;
chop_if_long
myField·=·someCondition ············?·true ············:·false;
wrap_if_long
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 { }

Wrap enum definition

Property names:

[resharper_]cpp_wrap_enumeration_style, [resharper_]wrap_enumeration_style

Possible values:

  • chop_always: Chop always
  • chop_if_long: Chop if long or multiline
  • wrap_if_long: Simple wrap

Examples:

chop_always
enum { ··ONE, ··TWO, ··THREE, ··FOUR, ··FIVE, ··SIX, ··SEVEN };
chop_if_long
enum { ··ONE, ··TWO, ··THREE, ··FOUR, ··FIVE, ··SIX, ··SEVEN };
wrap_if_long
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:

  • chop_always: Chop always
  • chop_if_long: Chop if long or multiline
  • wrap_if_long: Simple wrap

Examples:

chop_always
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} };
wrap_if_long
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:

  • chop_always: Chop always
  • chop_if_long: Chop if long or multiline
  • wrap_if_long: Simple wrap

Examples:

chop_always
class·Derived·:·BaseClass, ················I1, ················I2, ················I3, ················I4 { }
chop_if_long
class·Derived·:·BaseClass, ················I1, ················I2, ················I3, ················I4 { }
wrap_if_long
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:

  • chop_always: Chop always
  • chop_if_long: Chop if long or multiline
  • wrap_if_long: Simple wrap

Examples:

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; };
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; };
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; };

Wrap formal parameters

Property names:

[resharper_]cpp_wrap_parameters_style, [resharper_]wrap_parameters_style

Possible values:

  • chop_always: Chop always
  • chop_if_long: Chop if long or multiline
  • wrap_if_long: Simple wrap

Examples:

chop_always
void·SomeMethod(int·p1, ················int·p2, ················int·p3, ················int·p4) { }
chop_if_long
void·SomeMethod(int·p1, ················int·p2, ················int·p3, ················int·p4) { }
wrap_if_long
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) { }

Wrap invocation arguments

Property names:

[resharper_]cpp_wrap_arguments_style, [resharper_]wrap_arguments_style

Possible values:

  • chop_always: Chop always
  • chop_if_long: Chop if long or multiline
  • wrap_if_long: Simple wrap

Examples:

chop_always
CallMethod(arg1, ···········arg2, ···········arg3, ···········arg4, ···········arg5);
chop_if_long
CallMethod(arg1, ···········arg2, ···········arg3, ···········arg4, ···········arg5);
wrap_if_long
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);
Last modified: 7 December 2017