Skip to content

fix: ensure enclosing ranges contain occurrences - #469

Open
mskry wants to merge 1 commit into
sourcegraph:mainfrom
ByteOverDev:fix/enclosing-range-containment
Open

fix: ensure enclosing ranges contain occurrences#469
mskry wants to merge 1 commit into
sourcegraph:mainfrom
ByteOverDev:fix/enclosing-range-containment

Conversation

@mskry

@mskry mskry commented Aug 2, 2026

Copy link
Copy Markdown

Test plan

Reproduction

Use the existing enclosing-range fixture:

const test = () => {
  return 'value'
}

Before the fix, the occurrence covered test, while the enclosing range covered only the initializer:

occurrence:       test
enclosing range:         () => { ... }

The source-file occurrence had the same problem when the file started with comments: its occurrence was at [0,0,0], but its enclosing range started after the leading comments.

The new snapshot assertion fails when either malformed range is generated.

Verification

  • Added an assertion that every emitted enclosing_range contains its occurrence.
  • Updated the source-file and function-valued-variable snapshots.
  • Ran npm run test: 31/31 passed.
  • Ran npm run build.
  • Ran npm run prettier-check.
  • Ran npm run eslint.

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