-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Resolve syntactic symbol at request range #63189
Resolve syntactic symbol at request range #63189
Conversation
I've moved the utility functions to the SCIP repo. sourcegraph/scip#248 Rationale for the change:
|
9026896
to
f04d3b9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some initial comments, key one is changing the signature of the getSyntacticSymbolsAtRange
function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks directionally OK, left some minor improvement suggestions.
return nil, err | ||
} | ||
|
||
// TODO: Adjust symbolRange based on revision vs syntacticUpload.Commit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this purely a matter of calling GitTreeTranslator.GetTargetCommitRangeFromSourceRange
? If so, let's fix this right away instead of accruing a TODO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GitTreeTranslator
is also a cache and has a relatively complicated API, might be a good candidate to look at during pairing.
I'm hoping we don't need this for the MVP, but it's important not to forget about it
d605278
to
7194c00
Compare
Closes https://linear.app/sourcegraph/issue/GRAPH-666/resolve-syntactic-symbol-at-the-range-specified-in-the-usages-request
Because the new occurrences API allows passing both a symbol or a range we need to be able to retrieve the syntactic symbol at the given range.
I added some utilty functions to the
shared.Range
andshared.Position
types, which I assume are the position-ish types we want to use to communicate between resolver and codenav service code.I left a few NOTE and TODO's that I'd like to discuss during review.
Test plan
I added both unit as well as property based tests for the utility functions on position and range.
In order to test the service functions I'd need to mock a bunch of systems, and I'm not sure if the test would have any meaning at that point (the logic is basically a single iteration and overlap check). If you'd like me to add it anyways let me know.