lsif-typed: symbol reference occurrence owning scope
Created by: Strum355
Motivation and Approach
Call-hierarchy has been a long (but somewhat lesser) requested code-intelligence feature (see: https://github.com/sourcegraph/sourcegraph/issues/2881 and https://github.com/sourcegraph/sourcegraph/issues/2882). This is a feature most prevalent in IntelliJ n co, but is also finding its way through various Language Servers (slowly but surely). It is not currently in the LSIF spec, and this PR will only tackle its addition into LSIF Typed :smugcat:
This PR attempts to plug the gap by introducing a new field to the Occurrence
type, preliminarily called owner
, of type string
(denoting a Symbol
but alas protobuf doesn't have type aliases Symbol
value of the most logical/intuitive next higher-scoped Symbol
. For example:
package com.sourcegraph.lsif-kotlin
fun banana() {
// ^^^^^^ maven ... com/sourcegraph/lsif-kotlin/File#banana()
sundae()
// ^^^^^^ ... com/sourcegraph/lsif-kotlin/File#sundae()
// This occurrence would have the `owner` field as `maven ... com/sourcegraph/lsif-kotlin/File#banana()`
}
fun sundae() { ... }
From a database schema and backend implementation perspective, it would likely be almost identical to the way the existing Find References capability is serviced by LSIF typed , for both local and cross-repo intelligence..
Call Hierarchy Examples
BNF Grammar highlighting
Test plan
N/A docs addition