fix: intersect ranges using only the boundary lines own characters - #13146
Open
tonycoder-hub wants to merge 1 commit into
Open
fix: intersect ranges using only the boundary lines own characters#13146tonycoder-hub wants to merge 1 commit into
tonycoder-hub wants to merge 1 commit into
Conversation
…ters intersection() compared a.start.character with b.start.character (and the end characters) unconditionally, even when one of the ranges did not begin or end on the shared boundary line. A range that continues past that line covers all of it, so it must not clamp the other range's offsets. This made overlapping ranges come back as null, e.g. (1,0)-(1,5) against (1,3)-(2,0), and produced too-wide results when both ranges shared a boundary line. Un-skips the existing TODO test for the first case and adds coverage for the shared start/end line cases.
Contributor
|
All contributors have signed the CLA ✍️ ✅ |
3 tasks
Author
|
I have read the CLA Document and I hereby sign the CLA |
Author
|
recheck |
cursor
Bot
force-pushed
the
cursor/fix-range-intersection-shared-line-4cf6
branch
from
August 17, 2026 10:44
f6193f0 to
d2188f5
Compare
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.
Description
intersection()incore/util/ranges.tsused the other range's character offsets even when that range did not start or end on the boundary line.A same-line overlap such as
(1,0)-(1,5)vs(1,3)-(2,0)returnednull(min(5, 0) = 0). The repo already had a skipped test for this. Shared-start / shared-end multi-line cases were also too wide.Only endpoints that actually lie on the boundary line now contribute. Used by VS Code autocomplete LSP crawl to drop duplicate type definitions.
Distinct from #13143/#13144/#13145.
Checklist
Tests
Un-skipped the existing single-line overlap case and added two shared-boundary cases. All three fail on main.
cd core && npx cross-env NODE_OPTIONS=--experimental-vm-modules npx jest util/ranges.test.ts→ 24 passed, 10 skipped (unrelatedgetRangeInStringblock).