Skip to content

remove indentation of a logical operation if it's the operand of a conditional#1441

Merged
Janther merged 1 commit intomainfrom
conditional-indentation
Mar 8, 2026
Merged

remove indentation of a logical operation if it's the operand of a conditional#1441
Janther merged 1 commit intomainfrom
conditional-indentation

Conversation

@Janther
Copy link
Member

@Janther Janther commented Mar 4, 2026

since #1437 a conditional will be in it's own new line so there is no longer a need for the indentation of a logical operation if it's the operand of a conditional expression. This will also make the separation between operand and trueExpression more clear.

// Original
uint foo = longCondition1 || longCondition2 ? 1234567890 : 9876543210;

// Old
uint foo =
    longCondition1 ||
        longCondition2
        ? 1234567890 
        : 9876543210;

// New
uint foo =
    longCondition1 ||
    longCondition2
        ? 1234567890 
        : 9876543210;

This format is also congruent with what we see prettier do.

@Janther Janther requested a review from fvictorio March 4, 2026 20:12
@Janther Janther added the format Addresses a change in the format label Mar 4, 2026
@Janther Janther force-pushed the conditional-indentation branch from 7f7180a to e9aca48 Compare March 7, 2026 21:01
Copy link
Member

@fvictorio fvictorio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@Janther Janther merged commit 457de3e into main Mar 8, 2026
7 checks passed
@Janther Janther deleted the conditional-indentation branch March 8, 2026 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

format Addresses a change in the format

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants