fix an error when calling cmp#unregister_source from Vimscript (#413)

This commit is contained in:
Dmytro Meleshko
2021-10-26 15:02:10 +03:00
committed by GitHub
parent 538bfacc15
commit 32e22e64c6

View File

@@ -35,12 +35,9 @@ endfunction
" cmp#unregister_source
"
function! cmp#unregister_source(id) abort
for [l:i, l:source] in s:sources
if l:source.id == a:id
call remove(s:sources, index(s:sources, l:source))
break
if has_key(s:sources, a:id)
unlet s:sources[a:id]
endif
endfor
call luaeval('require("cmp").unregister_source(_A)', a:id)
endfunction
@@ -77,4 +74,3 @@ endfunction
function! s:callback(id) abort
return { ... -> luaeval('require("cmp.vim_source").on_callback(_A[1], _A[2])', [a:id, a:000]) }
endfunction