Skip to content

Commit 3d0fab1

Browse files
authored
fix: rust lsp location (#124)
1 parent df5a49f commit 3d0fab1

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

lang/rust/utils/lsp.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ func getSymbol(cli *lsp.LSPClient, root, file, mod, name string, receiver string
9595
// recursive search mod to the deepest
9696
syms = dfsSyms(syms, strings.Split(mod, "::"))
9797
}
98+
// fix: s.Location is missing; populating it using s.Range.
99+
for idx, s := range syms {
100+
if s.Location.URI == "" && s.Location.Range.Start.Line == 0 && s.Location.Range.End.Line == 0 && s.Range != nil {
101+
syms[idx].Location.URI = lsp.NewURI(file)
102+
syms[idx].Location.Range = *s.Range
103+
}
104+
}
98105
if receiver != "" {
99106
for _, s := range syms {
100107
if s.Kind == lsp.SKObject && ((caseInsensitive && (hasIdent(strings.ToLower(s.Name), strings.ToLower(receiver)))) || hasIdent(s.Name, receiver)) {

0 commit comments

Comments
 (0)