From e225174d1294714651271d45ef0966083da0b988 Mon Sep 17 00:00:00 2001 From: fgy Date: Tue, 2 Dec 2025 20:13:36 +0800 Subject: [PATCH] fix: rust lsp location --- lang/rust/utils/lsp.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lang/rust/utils/lsp.go b/lang/rust/utils/lsp.go index 89a83e09..d6fb11bf 100644 --- a/lang/rust/utils/lsp.go +++ b/lang/rust/utils/lsp.go @@ -95,6 +95,13 @@ func getSymbol(cli *lsp.LSPClient, root, file, mod, name string, receiver string // recursive search mod to the deepest syms = dfsSyms(syms, strings.Split(mod, "::")) } + // fix: s.Location is missing; populating it using s.Range. + for idx, s := range syms { + if s.Location.URI == "" && s.Location.Range.Start.Line == 0 && s.Location.Range.End.Line == 0 && s.Range != nil { + syms[idx].Location.URI = lsp.NewURI(file) + syms[idx].Location.Range = *s.Range + } + } if receiver != "" { for _, s := range syms { if s.Kind == lsp.SKObject && ((caseInsensitive && (hasIdent(strings.ToLower(s.Name), strings.ToLower(receiver)))) || hasIdent(s.Name, receiver)) {