runtime(vimcomplete): do not complete on empty line

closes: #18561

Signed-off-by: Maxim Kim <habamax@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Maxim Kim
2025-10-13 18:58:17 +00:00
committed by Christian Brabandt
parent 6ab45471d4
commit 5b058c76b4

View File

@ -3,7 +3,7 @@ vim9script
# Vim completion script
# Language: Vim script
# Maintainer: Maxim Kim <habamax@gmail.com>
# Last Change: 2025-08-27
# Last Change: 2025-10-13
#
# Usage:
# setlocal omnifunc=vimcomplete#Complete
@ -36,6 +36,9 @@ enddef
export def Complete(findstart: number, base: string): any
if findstart > 0
var line = getline('.')->strpart(0, col('.') - 1)
if line =~ '\s\+$'
return -2
endif
var keyword = line->matchstr('\k\+$')
var stx = synstack(line('.'), col('.') - 1)->map('synIDattr(v:val, "name")')->join()
if stx =~? 'Comment' || (stx =~ 'String' && stx !~ 'vimStringInterpolationExpr')