From 67f11b849a3153de6e5a74cda8dfb74867afaffe Mon Sep 17 00:00:00 2001 From: Andreas Louv Date: Thu, 1 Dec 2022 14:18:41 +0100 Subject: [PATCH] Support partially typing the omni completed keyword --- autoload/lsp/completion.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 -- 2.48.1