Skip to content

Commit a4de5d2

Browse files
authored
Merge pull request sourcegraph#107 from sourcegraph/sg/references-builtin
langserver: return 'no results' not an error on builtins
2 parents b5b72a0 + bdff614 commit a4de5d2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

langserver/references.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func (h *LangHandler) handleTextDocumentReferences(ctx context.Context, conn JSO
2626
// Invalid nodes means we tried to click on something which is
2727
// not an ident (eg comment/string/etc). Return no information.
2828
if _, ok := err.(*invalidNodeError); ok {
29-
return nil, nil
29+
return []lsp.Location{}, nil
3030
}
3131
return nil, err
3232
}
@@ -54,6 +54,11 @@ func (h *LangHandler) handleTextDocumentReferences(ctx context.Context, conn JSO
5454
}
5555

5656
if obj.Pkg() == nil {
57+
if _, builtin := obj.(*types.Builtin); builtin {
58+
// We don't support builtin references due to the massive number
59+
// of references, so ignore the missing package error.
60+
return []lsp.Location{}, nil
61+
}
5762
return nil, fmt.Errorf("no package found for object %s", obj)
5863
}
5964
defpkg := obj.Pkg().Path()

0 commit comments

Comments
 (0)