autoload/lsp/completion.vim | 11 +++-------- diff --git a/autoload/lsp/completion.vim b/autoload/lsp/completion.vim index 70bb2ae74269921287b7a8988ddaff15f35dea64..37690a0ff4fc0a3055d76ca28dd710e26ceaba5f 100644 --- a/autoload/lsp/completion.vim +++ b/autoload/lsp/completion.vim @@ -441,15 +441,10 @@ # initiate a request to LSP server to get list of completions lspserver.getCompletion(1, '') # 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 + var line = getline('.')->strpart(0, col('.') - 1) + var keyword = line->matchstr('\k\+$') lspserver.omniCompleteKeyword = keyword - return line->byteidx(start) + return line->len() - keyword->len() else # Wait for the list of matches from the LSP server var count: number = 0