]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
BUG: omnifuc throws E716
authorGirish Palya <girishji@gmail.com>
Tue, 6 Feb 2024 12:12:28 +0000 (13:12 +0100)
committerGirish Palya <girishji@gmail.com>
Tue, 6 Feb 2024 12:12:28 +0000 (13:12 +0100)
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:
https://github.com/girishji/vimcomplete/issues/14

M  autoload/lsp/completion.vim

autoload/lsp/completion.vim

index 4ea357775876f82e374feba7f4fb0d366cc7e160..aa93db1e0f3da78b103adfb15e0394a7e823d827 100644 (file)
@@ -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 = []
@@ -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
@@ -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