From: shane.xb.qian Date: Wed, 22 Mar 2023 06:21:44 +0000 (+0800) Subject: fix: starttext maybe incorrect X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=d17dc10e6c4cc99b205dade0c9e8d02a2588234d;p=vim-lsp.git fix: starttext maybe incorrect // set a safeguard of chcol Signed-off-by: shane.xb.qian --- diff --git a/autoload/lsp/completion.vim b/autoload/lsp/completion.vim index 65ad42b..4352591 100644 --- a/autoload/lsp/completion.vim +++ b/autoload/lsp/completion.vim @@ -90,7 +90,7 @@ export def CompletionReply(lspserver: dict, cItems: any) # Get the keyword prefix before the current cursor column. var chcol = charcol('.') - var starttext = getline('.')[ : chcol - 2] + var starttext = chcol == 1 ? '' : getline('.')[ : chcol - 2] var [prefix, start_idx, end_idx] = starttext->tolower()->matchstrpos('\k*$') var start_col = start_idx + 1