Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions langserver/hover.go
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,22 @@ func (h *LangHandler) handleHoverGodef(ctx context.Context, conn jsonrpc2.JSONRP

// Handle builtin objects with invalid locations.
if loc.URI == "file://" {
_, node, _, _, _, _, _ := h.typecheck(ctx, conn, params.TextDocument.URI, params.Position)

_, node, _, _, _, _, err := h.typecheck(ctx, conn, params.TextDocument.URI, params.Position)
if err != nil {
// Invalid nodes means we tried to click on something which is
// not an ident (eg comment/string/etc). Return no information.
if _, ok := err.(*invalidNodeError); ok {
return nil, nil
}
// This is a common error we get in production when a user is
// browsing a go pkg which only contains files we can't
// analyse (usually due to build tags). To reduce signal of
// actual bad errors, we return no error in this case.
if _, ok := err.(*build.NoGoError); ok {
return nil, nil
}
return nil, err
}
contents := builtinDoc(node.Name)
return &lsp.Hover{
Contents: contents,
Expand Down