Skip to content

Commit

Permalink
Show ident name on hover if type not found
Browse files Browse the repository at this point in the history
  • Loading branch information
harry-hov committed Apr 5, 2024
1 parent aa75b48 commit dd92cbb
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion internal/lsp/hover.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit dd92cbb

Please sign in to comment.