sourcegraph/internal/codeintel/codegraph/locus.go
Varun Gandhi dc7da57edb
chore: Make location fetching queries more uniform (#64026)
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.
2024-07-24 11:14:22 +02:00

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
}