ReSharper 2021.1 Help

Protobuf - Formatting Style

Tabs and indents

Indent style

Property names:

indent_style, [resharper_]protobuf_indent_style

Possible values:

  • tab: Tab

  • space: Spaces

Examples:

tab
option a = { a { x: 1 } b { y: 2 } }
space
option a = { a { x: 1 } b { y: 2 } }

Indent size

Property names:

indent_size, [resharper_]protobuf_indent_size

Possible values:

an integer

Examples:

value: 0
option a = { a { x: 1 } b { y: 2 } }
value: 1
option a = { a { x: 1 } b { y: 2 } }
value: 2
option a = { a { x: 1 } b { y: 2 } }

Tab width

Property names:

tab_width, [resharper_]protobuf_tab_width

Possible values:

an integer

Examples:

value: 0
option a = { a { x: 1 } b { y: 2 } }
value: 1
option a = { a { x: 1 } b { y: 2 } }
value: 2
option a = { a { x: 1 } b { y: 2 } }

How to align when tabs are used for indents

Property names:

[resharper_]protobuf_alignment_tab_fill_style, [resharper_]alignment_tab_fill_style

Possible values:

  • use_spaces: Use spaces (looks aligned on any tab size)

  • use_tabs_only: Only use tabs (inaccurate)

  • optimal_fill: Mix tabs and spaces for optimal fill

Align even if the resulting indentation is too large

Property names:

[resharper_]protobuf_allow_far_alignment, [resharper_]allow_far_alignment

Allow alignment even if construct is located too far to the right, more than 2/3 of `Hard wrap at` limit

Possible values:

true | false

Spaces

After comma in options

Property names:

[resharper_]protobuf_space_comma, [resharper_]space_comma

Possible values:

true | false

Examples:

true
message a { optional int32 a = 1 [default = 1, deprecated = true]; }
false
message a { optional int32 a = 1 [default = 1,deprecated = true]; }

Around = in fields and options

Property names:

[resharper_]protobuf_space_equals, [resharper_]space_equals

Possible values:

true | false

Examples:

true
message a { optional int32 a = 1 [default = 1, deprecated = true]; }
false
message a { optional int32 a=1 [default=1, deprecated=true]; }

Before : in aggregate options

Property names:

[resharper_]protobuf_space_colon_before, [resharper_]space_colon_before

Possible values:

true | false

Examples:

true
option a = { x : y, c : e };
false
option a = { x: y, c: e };

After : in aggregate options

Property names:

[resharper_]protobuf_space_colon_after, [resharper_]space_colon_after

Possible values:

true | false

Examples:

true
option a = { x: y, c: e };
false
option a = { x:y, c:e };

Indenting options

Curly braces not in options

Property names:

[resharper_]protobuf_not_options_braces, [resharper_]protobuf_brace_style, [resharper_]not_options_braces, [resharper_]brace_style

Possible values:

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

  • end_of_line_no_space: At 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
message a { optional int32 a = 1; message b { optional int32 c = 1; } }
end_of_line_no_space
message a{ optional int32 a = 1; message b{ optional int32 c = 1; } }
next_line
message a { optional int32 a = 1; message b { optional int32 c = 1; } }
next_line_shifted
message a { optional int32 a = 1; message b { optional int32 c = 1; } }
next_line_shifted_2
message a { optional int32 a = 1; message b { optional int32 c = 1; } }

Curly/pointy braces in aggregate values in options

Property names:

[resharper_]protobuf_options_braces, [resharper_]protobuf_brace_style, [resharper_]options_braces, [resharper_]brace_style

Possible values:

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

  • end_of_line_no_space: At 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
option a = { a { x: 1 } b { y: 2 } }
end_of_line_no_space
option a ={ a{ x: 1 } b{ y: 2 } }
next_line
option a = { a { x: 1 } b { y: 2 } }
next_line_shifted
option a = { a { x: 1 } b { y: 2 } }
next_line_shifted_2
option a = { a { x: 1 } b { y: 2 } }

Empty block style

Property names:

[resharper_]protobuf_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
message a { }
together
message a {}
together_same_line
message a {}

Wrapping and chopping

Hard wrap at

Property names:

max_line_length, [resharper_]protobuf_max_line_length

Possible values:

an integer

Other

Use pointy braces in aggregate options

Property names:

[resharper_]protobuf_options_braces_pointy, [resharper_]options_braces_pointy

Possible values:

true | false

Examples:

true
option a = { value1 <> value2 <> };
false
option a = { value1 {} value2 {} };
Last modified: 08 March 2021