Back to Devexpress

Wrapping

coderushforroslyn-401346-code-style-assistance-document-formatting-c-wrapping.md

latest1.7 KB
Original Source

Wrapping

  • Mar 15, 2021
  • 2 minutes to read

The Wrapping options page provides settings for the following code elements’ wrapping rules:

  • LINQ Expression
  • Arithmetic Expression
  • Relational Expression
  • Bitwise Expression
  • Logical Expression
  • Ternary Expression
  • Assignment Expression
  • Arguments
  • Parameters
  • Array Initializer
  • Collection Initializer
  • Object Initializer
  • Chained Method Calls
  • Lambda Expression
  • Expression Body
  • Type Parameters
  • Null Coalescing Expression
  • Base List
  • Constructor Initializer

Each element of these expressions has configuration options. You can set the following wrapping options:

  • How CodeRush should wrap expression elements:

  • The line break’s position before or after the code element.

  • Align by - allows CodeRush to align wrapped lines by an element at the first line.

  • Indent - allows you to specify wrapped lines indentation.

Note

CodeRush produces indents in the same way as Visual Studio formatting based on an .editorconfig file or Visual Studio’s indentation options (Text Editor\ C# \Tabs) if these options do not exist in the .editorconfig file.

  • Tolerance - you can specify the minimum parameter count for which the formatting rule is applied. This option is available for arguments, parameters, array initializers, collection initializers, and object initializers.
  • Wrap first - you can define whether to wrap the first element in an assignment expression.

The image below shows the wrapping settings for the Arguments item.