Skip to content

fix(codegen): fix inconsistent multiline EOF comment formatting#17983

Merged
graphite-app[bot] merged 1 commit intomainfrom
fix/codegen-eof-comment-formatting
Jan 14, 2026
Merged

fix(codegen): fix inconsistent multiline EOF comment formatting#17983
graphite-app[bot] merged 1 commit intomainfrom
fix/codegen-eof-comment-formatting

Conversation

@Boshen
Copy link
Member

@Boshen Boshen commented Jan 14, 2026

Summary

  • Clear the print_next_indent_as_space flag before printing EOF legal comments to ensure consistent formatting

When inline comments set the print_next_indent_as_space flag, it was leaking to EOF comment printing, causing inconsistent formatting where some multiline block comments had a leading space before * and others didn't.

Before:

/**
* @preserve
*/
/**
 * @preserve   <-- inconsistent leading space
*/

After:

/**
* @preserve
*/
/**
* @preserve
*/

Test plan

  • Existing tests pass
  • Snapshot updated to reflect the fix

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings January 14, 2026 07:40
@github-actions github-actions bot added A-codegen Area - Code Generation C-bug Category - Bug labels Jan 14, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes inconsistent multiline EOF comment formatting caused by the print_next_indent_as_space flag leaking from inline comments to EOF comment printing.

Changes:

  • Clear the print_next_indent_as_space flag before printing EOF legal comments to ensure consistent formatting
  • Update snapshot test to reflect the corrected formatting

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.

File Description
crates/oxc_codegen/src/comment.rs Added flag reset before EOF comment printing to prevent formatting inconsistencies
crates/oxc_codegen/tests/integration/snapshots/legal_eof_comments.snap Updated snapshot to reflect consistent multiline comment formatting without extra leading space

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 14, 2026

Merging this PR will not alter performance

✅ 38 untouched benchmarks
⏩ 7 skipped benchmarks1


Comparing fix/codegen-eof-comment-formatting (77c1933) with main (2619c66)

Open in CodSpeed

Footnotes

  1. 7 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Jan 14, 2026
Copy link
Member Author

Boshen commented Jan 14, 2026

Merge activity

## Summary

- Clear the `print_next_indent_as_space` flag before printing EOF legal comments to ensure consistent formatting

When inline comments set the `print_next_indent_as_space` flag, it was leaking to EOF comment printing, causing inconsistent formatting where some multiline block comments had a leading space before `*` and others didn't.

Before:
```js
/**
* @preserve
*/
/**
 * @preserve   <-- inconsistent leading space
*/
```

After:
```js
/**
* @preserve
*/
/**
* @preserve
*/
```

## Test plan

- Existing tests pass
- Snapshot updated to reflect the fix

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@graphite-app graphite-app bot force-pushed the fix/codegen-eof-comment-formatting branch from 77c1933 to 1874765 Compare January 14, 2026 08:15
@graphite-app graphite-app bot merged commit 1874765 into main Jan 14, 2026
20 checks passed
@graphite-app graphite-app bot deleted the fix/codegen-eof-comment-formatting branch January 14, 2026 08:22
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Jan 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-codegen Area - Code Generation C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants