Repository navigation
fix(format): keep range formatting on a top-level comment idempotent - #2863
Merged
Merged
Conversation
A directive owns the NEWLINE that ends it; a top-level comment token does not, while the emitter ends the comment's line with one. The range snap stopped at the comment token, so each run replaced `; c` with `; c\n` and a file-leading comment gained a blank line after it every time. The snap now takes the comment's own NEWLINE. The snap also uses the canonical `is_comment_kind` instead of a hand-written list. Closes #2838 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
📊 Benchmark Results
vs base, measured in this run
A difference counts only when it clears the combined spread of the two measurements, per shape (2σ: What do these numbers mean?
|
Contributor
✅ Compatibility Test Results
What's tested
Full results available in workflow artifacts |
Co-Authored-By: Claude Opus 5.5 <[email protected]>
robcohen
enabled auto-merge (squash)
November 5, 2026 05:12
robcohen
added a commit
that referenced
this pull request
Nov 5, 2026
… two doc claims Merges main (CHANGELOG conflict with #2863: both entries kept). Review of #2869: a test now covers the inlay-hint hunk (explicit `Expenses:Restaurants -50.00 USD`, elided `Assets:생활`: UTF-16 position 11 and a 12-space gap; counting characters gave 14). The tab comment said unicode-width gives a tab 0 cells; it gives 1. compatibility.md section 19 now says ASCII-only amount alignment is unchanged and matches bean-format, instead of claiming whole-file parity. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
format_node_range_with_style: when the snapped range ends on a top-level comment token, the snap now takes that comment's own NEWLINE. The snap also uses the canonicalconvert::is_comment_kindinstead of a hand-written list of comment kinds.Why
A directive owns the NEWLINE that ends it, but a top-level comment token does not, and the emitter ends the comment's line with one. Selecting a file-leading comment snapped to
0..3(; c), and the replacement was; c\n, so every format-selection added a blank line after the comment. That happened on clean files too.How to test
cargo test -p rustledger-parser --test range_format_comment_idempotent(2 tests, both fail on main):The parser and LSP suites pass, including the range-vs-whole-file drift guard from #2837.
Closes #2838
🤖 Generated with Claude Code