Open varungandhi-src opened 8 months ago
There's 2 ways of addressing this:
If I'm understanding correctly, you're proposing (2), which I agree is the right approach.
I'm proposing a 3rd alternative, where we modify the SCIP data to include an extra is_reference
relationship to connect the two distinct symbols for the purpose of 'Find references'. We already do this in scip-ruby for some cases.
There's no need to modify any client-side code.
This PR here implements several critical changes that might address this https://github.com/sourcegraph/scip-typescript/pull/256
I think it's mostly ready for merging. It's an overall huge improvement in how we map properties of object literals to type members. I didn't merge it because I didn't have the bandwidth to communicate the changes or deal with feedback after publishing the change.
In that PR, I opted for an encoding where we emit plain reference occurrences on the object literal properties. This encoding can be undesirable in some cases, and we can later refine it to use is_reference
. The most important change in the PR is that it adds new infrastructure to map object literal properties to type members, which is a criteria to fix this problem.
Reported in Slack: https://sourcegraph.slack.com/archives/CHXHX7XAS/p1703179808338909
Here is a link to the ref panel, started at a slightly different point.
https://sourcegraph.com/github.com/sourcegraph/cody@807ea71d868fb7a1e74471bb67396b52acb704d8/-/blob/lib/ui/src/Chat.tsx?L202:5-202:28#tab=references
Explanation for the current behavior
To match the desired behavior more closely, we could potentially use the
is_reference
relationship in SCIP to match the local symbol with the global symbol. https://github.com/sourcegraph/scip/blob/1d0b24e10fa549e80d7c3f9f86df1238a0f5ae62/scip.proto#L439-L463