fix: SCIP index no longer generates non-existent occurrence ranges - #296
Merged
Merged
Conversation
Contributor
Author
|
This change is part of the following stack: Change managed by git-spice. |
chrapkowski-sg
force-pushed
the
fix-scip-index-no-longer
branch
from
September 17, 2026 13:40
ec5be25 to
a34c1a3
Compare
chrapkowski-sg
marked this pull request as ready for review
September 17, 2026 14:05
keegancsmith
approved these changes
Sep 17, 2026
keegancsmith
left a comment
There was a problem hiding this comment.
I'm not sure if this repo has a reasonable linter already setup so probably just ignore this general comment. But we could ban the use of Position? But yeah, LGTM! Love snapshot tests :)
| for _, f := range pkg.Syntax { | ||
| doc := pathToDocuments[pkg.Fset.File(f.Package).Name()] | ||
| position := pkg.Fset.Position(f.Name.NamePos) | ||
| position := pkg.Fset.PositionFor(f.Name.NamePos, false) |
There was a problem hiding this comment.
just checking. so these switches to PositionFor false are the most important right, since it makes the //line comments ignored.
added 2 commits
September 17, 2026 18:51
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.
Fix SCIP occurrence ranges for generated Go files containing
//linedirectives, such as files produced by goyacc.FileSet.Positionhonours these directives. Column-less directives report anunknownGo column as0, which became-1after conversion to SCIP’s zero-based coordinates. Adjusted line numbers could also point into the logical generator source rather than the emitted.godocument.This changes occurrence range calculation to use unadjusted physical positions via
PositionFor(pos, false). Package declarations, imports, identifiers, selectors, and enclosing ranges now consistently point into the physical Go document represented by the SCIP index.Adds a snapshot test covering package, import, definition, reference, and enclosing ranges after a
//linedirective.