From dd92cbbe71b91db0d5c66611f7098c7c2da7271a Mon Sep 17 00:00:00 2001 From: Hariom Verma Date: Fri, 5 Apr 2024 20:26:32 +0530 Subject: [PATCH] Show ident name on hover if type not found --- internal/lsp/hover.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/internal/lsp/hover.go b/internal/lsp/hover.go index bc49f2b..e9726a1 100644 --- a/internal/lsp/hover.go +++ b/internal/lsp/hover.go @@ -85,7 +85,16 @@ func (s *server) Hover(ctx context.Context, reply jsonrpc2.Replier, req jsonrpc2 case *ast.SelectorExpr: return hoverSelectorExpr(ctx, s, reply, params, pgf, pkg, paths, n, t, int(line)) default: - return reply(ctx, nil, nil) + return reply(ctx, protocol.Hover{ + Contents: protocol.MarkupContent{ + Kind: protocol.Markdown, + Value: FormatHoverContent(n.Name, ""), + }, + Range: posToRange( + int(params.Position.Line), + []int{int(n.Pos()), int(n.End())}, + ), + }, nil) } } typeStr := tv.Type.String()