Skip to content

Preserve formatter alignment across tabs and enum decorators - #65463

Open
Jake Bailey (jakebailey) wants to merge 1 commit into
microsoft:mainfrom
jakebailey:compiler-fixes/formatter-indentation
Open

Jake Bailey (jakebailey) wants to merge 1 commit into
microsoft:mainfrom
jakebailey:compiler-fixes/formatter-indentation

Conversation

@jakebailey

Copy link
Copy Markdown
Member

Mixed leading whitespace must advance to the next tab stop so multiline comments retain their relative indentation when formatting changes the surrounding block indentation.

Match the enum keyword after decorators so partially written declarations stay aligned instead of gaining an extra indentation level.

Mixed leading whitespace must advance to the next tab stop so multiline
comments retain their relative indentation when formatting changes the
surrounding block indentation.

Match the enum keyword after decorators so partially written declarations
stay aligned instead of gaining an extra indentation level.
Copilot AI balanced review requested due to automatic review settings November 13, 2026 03:11
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Nov 13, 2026
@typescript-automation typescript-automation Bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Nov 13, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues remain for the tab-stop and decorator indentation changes.

No open issues 🎉

What changed in this PR

This PR fixes indentation handling in the native TypeScript formatter so mixed whitespace and decorators do not disrupt alignment during editing.

Changes:

  • Advances tabs to the next tab stop, preserving multiline comments’ relative indentation.
  • Matches the enum keyword after decorators to avoid an extra indentation level.
  • Adds fourslash regression tests for both cases.
File Description
tsc/​internal/​fourslash/​tests/​formattingMultilineCommentsWithTabs1_test.go Tests multiline comment alignment with mixed spaces and tabs.
tsc/​internal/​fourslash/​tests/​formattingDecorators_test.go Tests enum alignment when an invalid decorator is present.
tsc/​internal/​format/​span.go Uses the enum keyword token for alignment after decorators.
tsc/​internal/​format/​indent.go Corrects tab-stop column calculation.

Review effort: Balanced

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

2 participants