From: Andreas Louv Date: Thu, 1 Dec 2022 13:18:41 +0000 (+0100) Subject: Support partially typing the omni completed keyword X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=67f11b849a3153de6e5a74cda8dfb74867afaffe;p=vim-lsp.git Support partially typing the omni completed keyword --- diff --git a/autoload/lsp/completion.vim b/autoload/lsp/completion.vim index 5c6554e..ce4d949 100644 --- a/autoload/lsp/completion.vim +++ b/autoload/lsp/completion.vim @@ -273,9 +273,12 @@ def g:LspOmniFunc(findstart: number, base: string): any # locate the start of the word var line = getline('.') var start = charcol('.') - 1 + var keyword: string = '' while start > 0 && line[start - 1] =~ '\k' + keyword = line[start - 1] .. keyword start -= 1 endwhile + lspserver.omniCompleteKeyword = keyword return start else # Wait for the list of matches from the LSP server @@ -289,7 +292,7 @@ def g:LspOmniFunc(findstart: number, base: string): any endwhile var res: list> = lspserver.completeItems - return res->empty() ? v:none : res + return res->empty() ? v:none : res->filter((i, v) => v.word =~# '^' .. lspserver.omniCompleteKeyword) endif enddef