Skip to content

fix: keep the outer range when Range.simplify merges a contained range - #2441

Merged
Connor Peet (connor4312) merged 1 commit into
microsoft:mainfrom
NgoQuocViet2001:fix-range-simplify-contained
Oct 26, 2026
Merged

Connor Peet (connor4312) merged 1 commit into
microsoft:mainfrom
NgoQuocViet2001:fix-range-simplify-contained

Conversation

@NgoQuocViet2001

Copy link
Copy Markdown
Contributor

Range.simplify always took the next range's end when merging. If the next range sits inside the current one, the merged range shrinks to the inner end, and later ranges that the outer range still covers come back as separate pieces:

Range.simplify([0:0-0:10, 0:2-0:5, 0:7-0:8])
before: Range[0:0 -> 0:5], Range[0:7 -> 0:8]
after:  Range[0:0 -> 0:10]

The result is used by Thread.getCurrentSkipList as the skipList for step over/into. For WASM/DWARF frames that list mixes inlined callee ranges with the current line's ranges, so a contained range can cut off the tail of a region that should be skipped. The merge now only extends the current range when the next one ends later. This matches sortAndMergeRanges in DevTools' DebuggerModel.

  • Ran: the positions.test.ts mocha file. The new test fails on main (Range[0:0 -> 0:5], Range[0:7 -> 0:8]) and all 7 pass with the change.
  • Ran: npm run test:unit, 297 passing. The 8 NodeBinaryProvider failures also fail locally on main.
  • Checked: npm run test:types, plus dprint check and eslint --max-warnings=0 on both files: clean.

@connor4312 Connor Peet (connor4312) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thank you!

@connor4312
Connor Peet (connor4312) merged commit a9df030 into microsoft:main Oct 26, 2026
6 checks passed
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.

4 participants