autoload/lsp/completion.vim | 5 ++++- diff --git a/autoload/lsp/completion.vim b/autoload/lsp/completion.vim index 5c6554e382459bd7a2645b1c2c5ef74c24d1423f..ce4d9495d2b9ec898d05f38ac9c926267819d80d 100644 --- a/autoload/lsp/completion.vim +++ b/autoload/lsp/completion.vim @@ -273,9 +273,12 @@ # 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 @@ count += 1 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