Skip to main content

Spacing

  • 2 minutes to read

The Spacing page contains options which allow you to add or omit whitespace symbols around the following code elements:

  • Arithmetic Expression

  • Relational Expression

  • Bitwise Expression

  • Logical Expression

  • Unary Expression

    • Space before a postfix unary operator
    • Space after a prefix unary operator
  • Ternary Expression

    • Space before a question mark
    • Space after a question mark
    • Space before a colon
    • Space after a colon
  • Assignment Expression

    • Spaces around an operator
  • Expression

    • Space before parentheses
    • Spaces within parentheses
  • Statement

    • Space before parentheses
    • Spaces within parentheses
    • Space before a semicolon
    • Space before semicolons in ‘for’ loops
    • Space after semicolons in ‘for’ loops
    • Space before a colon in ‘case’ expressions
  • Arguments

    • Space before parentheses
    • Spaces within parentheses
    • Space within empty parentheses
    • Space before a separator (comma)
    • Space after a separator (comma)
    • Space before a colon in a named parameter
    • Space after a colon in a named parameter
  • Parameters

    • Space before parentheses
    • Spaces within parentheses
    • Space within empty parentheses
    • Space before a separator (comma)
    • Space after a separator (comma)
  • Initializer

    • Spaces within braces
    • Space before a separator (comma)
    • Space after a separator (comma)
  • Lambda Expression

    • Spaces around an arrow
  • Expression Body

    • Spaces around an arrow
  • Type Parameters

    • Space before angle brackets
    • Spaces within angle brackets
    • Space before a separator (comma)
    • Space after a separator (comma)
    • Space before a colon
    • Space after a colon
  • Type Arguments

    • Space before angle brackets
    • Spaces within angle brackets
    • Space before a separator (comma)
    • Space after a separator (comma)
    • Space after a separator (comma) when type arguments are omitted
  • Attributes

    • Space before a colon in target specifier
    • Space after a colon in target specifier
    • Spaces within brackets
  • Null Coalescing Expression

    • Spaces around an operator
  • Base List

    • Space before a colon
    • Space after a colon
    • Space before a comma
    • Space after a comma
  • Constructor Initializer

    • Space before a colon
    • Space after a colon
  • Comment

    • Single line comments should begin with a single space

The image below shows settings applied to an Expression.

Formatting_Spaces