Skip to content

Grouping Parentheses #138722

Open
Open
@DarkTyger

Description

@DarkTyger

What do you think about adding GroupingParentheses to SpacesInParensOptions?

That is, GroupingParentheses: false would produce:

    if( (x + 5) == 7 ) { … }
    int x = (((3 + y) * (j - 5)) + (k * k));

Currently, when given:

SpacesInCStyleCastParentheses: true
SpacesInConditionalStatement: true
SpacesInContainerLiterals: false
SpacesInParentheses: true
SpacesInParens: Custom
SpacesInParensOptions:
  ExceptDoubleParentheses: false
  InConditionalStatements: true
  InCStyleCasts: true
  InEmptyParentheses: false
  Other: true

clang-format generates the far-too-spacious (IMO):

    if( ( x + 5 ) == 7 ) { … }
    int x = ( ( ( 3 + y ) * ( j - 5 ) ) + ( k * k ) );

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions