Skip to content

Conversation

@wukongO-O
Copy link

@wukongO-O wukongO-O commented Mar 15, 2025

Fixes #3676

  • This PR provides a solution to the aggressive indentation for nested conditional expressions using a specific style (issue Indentation is too aggressive for ternary operator #3676). Instead of using a one-liner, the style keeps the true branch in the same line as its associated condition but the false branch in the next line. Without the changes in this PR, the false branch gets mistakenly indented. This PR corrects the behavior by specifying this category of style in the function nodeWillIndentChild in smartindenter.ts.
  • The added unit test includes examples mentioned in the original issue and discussion.
  • The solution does not address the "different, but similar" example in the last comment on May 31, 2019. I'm not sure if it's opened as a separate issue already? Also, when I stepped through that example, it appears that the issue might be more related to how context node is assigned to child node, and how indentation, delta, node start position get inherited/recalculated with nested, mixed types.
  • As of now, the code is up to date and all tests, including the new test, passed locally.

@github-project-automation github-project-automation bot moved this to Not started in PR Backlog Mar 15, 2025
@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Mar 15, 2025
@typescript-bot
Copy link
Collaborator

This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise.

@wukongO-O
Copy link
Author

@microsoft-github-policy-service agree

@wukongO-O
Copy link
Author

This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise.

#3676

@typescript-bot typescript-bot added For Backlog Bug PRs that fix a backlog bug and removed For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Mar 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Backlog Bug PRs that fix a backlog bug

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

Indentation is too aggressive for ternary operator

2 participants