Skip to content

Commit

Permalink
Handle hoven on selector expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
harry-hov committed Mar 31, 2024
1 parent afdbefe commit 25b68ba
Show file tree
Hide file tree
Showing 3 changed files with 161 additions and 150 deletions.
28 changes: 28 additions & 0 deletions internal/lsp/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,34 @@ func getTypeAndValue(
return nil, nil
}

// Use getTypeAndValue instead
// TODO: should be removed
func getTypeAndValueLight(
fset token.FileSet,
info *types.Info,
tok string,
line int,
) (ast.Expr, *types.TypeAndValue) {
for expr, tv := range info.Types {
if tok != types.ExprString(expr) {
continue
}
posn := fset.Position(expr.Pos())
if line != posn.Line {
continue
}

// tv.Value.
tvstr := tv.Type.String()
if tv.Value != nil {
tvstr += " = " + tv.Value.String()
}

return expr, &tv
}
return nil, nil
}

func mode(tv types.TypeAndValue) string {
switch {
case tv.IsVoid():
Expand Down
2 changes: 1 addition & 1 deletion internal/lsp/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ type Symbol struct {
Name string
Doc string
Signature string
Kind string
Kind string // should be enum
}

type Function struct {
Expand Down
Loading

0 comments on commit 25b68ba

Please sign in to comment.