Skip to content

Commit

Permalink
Append parentheses to function name in text completion
Browse files Browse the repository at this point in the history
Previously, when using the text completion feature for function
names, it didn't automatically add parentheses.

Fixed it.
  • Loading branch information
harry-hov committed Jan 9, 2024
1 parent 139429a commit 7213e04
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions internal/lsp/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,13 @@ func (s *server) Completion(ctx context.Context, reply jsonrpc2.Replier, req jso
if pkg != nil {
for _, s := range pkg.Symbols {
items = append(items, protocol.CompletionItem{
Label: s.Name,
InsertText: s.Name,
Label: s.Name,
InsertText: func() string {
if s.Kind == "func" {
return s.Name + "()"
}
return s.Name
}(),
Kind: symbolToKind(s.Kind),
Detail: s.Signature,
Documentation: s.Doc,
Expand Down

0 comments on commit 7213e04

Please sign in to comment.