mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 18:31:54 +00:00
This patch changes the location querying code so that:
1. We're populating structures corresponding to SCIP instead of LSIF
(with "scheme" and "identifier" inside "MonikerData")
2. Avoid repeatedly allocating a constant string 'scip' for the scheme
only to throw it away later.
3. Makes the two queries and their scanning code more similar for easier
comparison. When I land precise usagesForSymbol, I will de-duplicate
some of the scanning code between these two queries.
I have avoided renaming all of the local variables to avoid creating
more noise.
## Test plan
Covered by existing tests.
28 lines
543 B
Go
28 lines
543 B
Go
package codegraph
|
|
|
|
import (
|
|
"github.com/sourcegraph/scip/bindings/go/scip"
|
|
|
|
"github.com/sourcegraph/sourcegraph/internal/codeintel/core"
|
|
)
|
|
|
|
// Locus represents a source range within a document as found in the DB.
|
|
//
|
|
// We will eventually rename this to Location once we get rid of the
|
|
// existing Location, LocationData etc. types.
|
|
type Locus struct {
|
|
Path core.UploadRelPath
|
|
Range scip.Range
|
|
}
|
|
|
|
type UploadLoci struct {
|
|
UploadID int
|
|
Loci []Locus
|
|
}
|
|
|
|
type UploadSymbolLoci struct {
|
|
UploadID int
|
|
Symbol string
|
|
Loci []Locus
|
|
}
|