From d17dc10e6c4cc99b205dade0c9e8d02a2588234d Mon Sep 17 00:00:00 2001 From: "shane.xb.qian" Date: Wed, 22 Mar 2023 14:21:44 +0800 Subject: [PATCH] fix: starttext maybe incorrect // set a safeguard of chcol Signed-off-by: shane.xb.qian --- autoload/lsp/completion.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- 2.48.1