[ty] Fix folding ranges of comments separated by statements#24132
Merged
MichaReiser merged 2 commits intomainfrom Mar 23, 2026
Merged
[ty] Fix folding ranges of comments separated by statements#24132MichaReiser merged 2 commits intomainfrom
MichaReiser merged 2 commits intomainfrom
Conversation
9105113 to
0b3f5f1
Compare
0b3f5f1 to
8bfeacd
Compare
charliermarsh
approved these changes
Mar 23, 2026
Co-authored-by: Charlie Marsh <[email protected]>
carljm
added a commit
that referenced
this pull request
Mar 25, 2026
* main: (36 commits) [ty] Reduce diagnostic range for `invalid-metaclass` (#24145) [ty] Simplify TypeVar assignability/subtyping logic (#24138) [ty] Prevent tainted loop bindings in cycle normalization (#24143) [ty] Add precisely-typed overloads for `TypedDict` update (#24101) [ty] Fix folding ranges of comments separated by statements (#24132) Bump ecosystem-analyzer pin (#24136) Bump ecosystem-analyzer pin (#24135) Simplify `NewType` handling in `relation.rs` (#24109) [ty] Add more tests for `NewType` subtyping (#24115) [ty] Add `NewType`s to the property tests (#24113) [ty] Prepare test files for unreachable code change (#24133) `analyze graph`: resolve string imports that reference attributes, not just modules (#24058) Update Artifact GitHub Actions dependencies (#24116) Update taiki-e/install-action action to v2.68.33 (#24130) Update taiki-e/install-action action to v2.68.32 (#24123) Update Rust crate serde_with to v3.18.0 (#24126) Update Swatinem/rust-cache action to v2.9.1 (#24127) Update Rust crate quick-junit to 0.6.0 (#24125) Update Rust crate clap to v4.6.0 (#24124) Update Rust crate tracing-subscriber to v0.3.23 (#24122) ...
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.
Summary
I rewrote the comment folding in #23831 to use comment ranges instead of iterating over the file's range.
However, I failed to account for the case where two comments are separated by statements.
This PR groups comments together only when they're separated by whitespace.
Fixes astral-sh/ty#3106
Test Plan
Added regression test
Screen.Recording.2026-03-23.at.12.10.43.mov