Skip to content

Commit

Permalink
BUG: omnifuc throws E716
Browse files Browse the repository at this point in the history
In LspOmniFunc() when cItems is empty (when findstart=1) it does not
set the key 'completeItemsIsIncomplete' in the lspserver dictionary.
When LspOmniFunc is called again with findstart=0, it fails.
line   46:
E716: Key not present in Dictionary: "completeItemsIsIncomplete"

This affects rust, nix, and other lsp servers:
girishji/vimcomplete#14

M  autoload/lsp/completion.vim
  • Loading branch information
girishji committed Feb 6, 2024
1 parent fb18f22 commit 31f3ec8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions autoload/lsp/completion.vim
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ enddef
# process the 'textDocument/completion' reply from the LSP server
# Result: CompletionItem[] | CompletionList | null
export def CompletionReply(lspserver: dict<any>, cItems: any)
lspserver.completeItemsIsIncomplete = false
if cItems->empty()
if lspserver.omniCompletePending
lspserver.completeItems = []
Expand All @@ -155,8 +156,6 @@ export def CompletionReply(lspserver: dict<any>, cItems: any)
return
endif

lspserver.completeItemsIsIncomplete = false

var items: list<dict<any>>
if cItems->type() == v:t_list
items = cItems
Expand Down Expand Up @@ -469,6 +468,7 @@ enddef

# omni complete handler
def g:LspOmniFunc(findstart: number, base: string): any

var lspserver: dict<any> = buf.CurbufGetServerChecked('completion')
if lspserver->empty()
return -2
Expand Down

0 comments on commit 31f3ec8

Please sign in to comment.