mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-24 06:30:03 +08:00
34 lines
991 B
VimL
34 lines
991 B
VimL
if a:findstart
|
|
if exists('s:completer') | unlet s:completer | endif
|
|
|
|
let l:pos = col('.') - 1
|
|
let l:line = getline('.')[:l:pos-1]
|
|
for l:completer in s:completers
|
|
if !get(l:completer, 'enabled', 1) | continue | endif
|
|
|
|
for l:pattern in l:completer.patterns
|
|
if l:line =~# l:pattern
|
|
let s:completer = l:completer
|
|
while l:pos > 0
|
|
if l:line[l:pos - 1] =~# '{\|,\|\[\|\\'
|
|
\ || l:line[l:pos-2:l:pos-1] ==# ', '
|
|
let s:completer.context = matchstr(l:line, '\S*$')
|
|
return l:pos
|
|
else
|
|
let l:pos -= 1
|
|
endif
|
|
endwhile
|
|
return -2
|
|
endif
|
|
endfor
|
|
endfor
|
|
return -3
|
|
else
|
|
if !exists('s:completer') | return [] | endif
|
|
|
|
return g:matchup_complete_close_braces && get(s:completer, 'inside_braces', 1)
|
|
\ ? s:close_braces(s:completer.complete(a:base))
|
|
\ : s:completer.complete(a:base)
|
|
endif
|
|
|