Skip to content

Commit

Permalink
Fix issue with completing idents in the language server (#2917)
Browse files Browse the repository at this point in the history
* Don't trim prefix from ident completions

* Fix test
  • Loading branch information
Tatskaari authored Nov 1, 2023
1 parent 22f0242 commit fe0b151
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tools/build_langserver/lsp/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (h *Handler) completeIdent(doc *doc, s string, line, col int) (*lsp.Complet
list := &lsp.CompletionList{}
for name, f := range h.builtins {
if strings.HasPrefix(name, s) {
item := completionItem(name, s, line, col)
item := completionItem(name, "", line, col)
item.Documentation = f.Stmt.FuncDef.Docstring
item.Kind = lsp.CIKFunction
list.Items = append(list.Items, item)
Expand Down
4 changes: 2 additions & 2 deletions tools/build_langserver/lsp/lsp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ func TestCompletionFunction(t *testing.T) {
Label: "plugin_repo",
Kind: lsp.CIKFunction,
InsertTextFormat: lsp.ITFPlainText,
TextEdit: textEdit("in_repo", 0, 4),
TextEdit: textEdit("plugin_repo", 0, 4),
Documentation: h.builtins["plugin_repo"].Stmt.FuncDef.Docstring,
}},
}, completions)
Expand Down Expand Up @@ -491,7 +491,7 @@ func TestCompletionPartialFunction(t *testing.T) {
Label: "plugin_repo",
Kind: lsp.CIKFunction,
InsertTextFormat: lsp.ITFPlainText,
TextEdit: textEdit("po", 0, 9),
TextEdit: textEdit("plugin_repo", 0, 9),
Documentation: h.builtins["plugin_repo"].Stmt.FuncDef.Docstring,
}},
}, completions)
Expand Down

0 comments on commit fe0b151

Please sign in to comment.