]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
Fix bug where buffer completion spams
authorGirish Palya <girishji@gmail.com>
Thu, 1 Jun 2023 14:13:57 +0000 (16:13 +0200)
committerGirish Palya <girishji@gmail.com>
Thu, 1 Jun 2023 14:13:57 +0000 (16:13 +0200)
Steps to reproduce:
- Enable buffer completion
- Search for 'xyz' where 'xy' has completions
- Backspace to remove 'z'
- You'll see all items from current buffer shown that are not related
  to 'xy'

M  autoload/lsp/completion.vim

autoload/lsp/completion.vim

index fffc3e69ddc8578b445236fcaabd8a2d54f356d6..1b8e53cdb976eefea9a19e886ed51a6019fe46fa 100644 (file)
@@ -228,8 +228,9 @@ export def CompletionReply(lspserver: dict<any>, cItems: any)
       # snippet completion.  Needs a snippet plugin to expand the snippet.
       # Remove all the snippet placeholders
       d.word = MakeValidWord(d.word)
-    elseif !lspserver.completeItemsIsIncomplete
-      # Don't attempt to filter on the items, when "isIncomplete" is set
+    elseif !lspserver.completeItemsIsIncomplete || opt.lspOptions.useBufferCompletion
+      # Filter items only when "isIncomplete" is set (otherwise server would
+      #   have done the filtering) or when buffer completion is enabled
 
       # plain text completion
       if prefix != ''