codeintel: Fix reference moniker translation (#46391)

This commit is contained in:
Eric Fritz 2023-01-12 14:57:50 -06:00 committed by GitHub
parent 47716b109f
commit 542e437ce9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 5 deletions

View File

@ -77,7 +77,7 @@ func TestSCIPMigrator(t *testing.T) {
if err != nil {
t.Fatalf("unexpected error counting symbols: %s", err)
}
if expected := 3307; symbolsCount != expected {
if expected := 4221; symbolsCount != expected {
t.Fatalf("unexpected number of documents. want=%d have=%d", expected, symbolsCount)
}
}

View File

@ -227,11 +227,11 @@ func convertRange(
for _, targetRangeID := range targetRangeFetcher(r.DefinitionResultID) {
// Add reference to the defining range identifier
addOccurrence(constructSymbolName(uploadID, targetRangeID), role)
}
// Add reference to each moniker
for _, moniker := range monikers {
addOccurrence(moniker, role)
}
// Add reference to each moniker
for _, moniker := range monikers {
addOccurrence(moniker, role)
}
}

View File

@ -46,11 +46,13 @@ func TestConvertLSIF(t *testing.T) {
{
RelativePath: "bar.go",
Occurrences: []*scip.Occurrence{
{Range: []int32{4, 5, 6, 7}, Symbol: "scheme A . pkg A v0.1.0 `ident A`."},
{Range: []int32{6, 7, 8, 9}, Symbol: "lsif . 42 . `7`."},
{Range: []int32{6, 7, 8, 9}, Symbol: "scheme B . pkg B v1.2.3 `ident B`."},
},
Symbols: []*scip.SymbolInformation{
{Symbol: "lsif . 42 . `7`.", Documentation: []string{"```go\ntext A\n```"}},
{Symbol: "scheme A . pkg A v0.1.0 `ident A`."},
{Symbol: "scheme B . pkg B v1.2.3 `ident B`.", Documentation: []string{"```go\ntext A\n```"}},
},
},