Skip to content

fix: intersect ranges using only the boundary lines own characters - #13146

Open
tonycoder-hub wants to merge 1 commit into
continuedev:mainfrom
tonycoder-hub:cursor/fix-range-intersection-shared-line-4cf6
Open

fix: intersect ranges using only the boundary lines own characters#13146
tonycoder-hub wants to merge 1 commit into
continuedev:mainfrom
tonycoder-hub:cursor/fix-range-intersection-shared-line-4cf6

Conversation

@tonycoder-hub

Copy link
Copy Markdown

Description

intersection() in core/util/ranges.ts used 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) returned null (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

  • I've read the contributing guide
  • The relevant docs, if any, have been updated or created
  • The relevant tests, if any, have been updated or created

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 (unrelated getRangeInString block).

…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.
@tonycoder-hub
tonycoder-hub requested a review from a team as a code owner August 17, 2026 10:28
@tonycoder-hub
tonycoder-hub requested review from sestinj and removed request for a team August 17, 2026 10:28
@github-actions

github-actions Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@tonycoder-hub

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@tonycoder-hub

Copy link
Copy Markdown
Author

recheck

@cursor
cursor Bot force-pushed the cursor/fix-range-intersection-shared-line-4cf6 branch from f6193f0 to d2188f5 Compare August 17, 2026 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant