mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 11:58:17 +00:00
provider: let providers decide their status
Instead of deciding provider status in eval_has_provider, move the decision to the provider Vim scripts. Previously, provider loading worked as follows: 1. eval_has_provider() verified provider availability by searching for the provider#providername#Call function and cached this verificaion as a static variable for some providers 2. providers short-circuited on loading to prevent the definition of the Call function (with the exception of the node provider that did not) This commit changes the expected interface between nvim and its providers to facilitate provider reloading, by splitting the verification of the provider from the availability of the Call function. eval_has_provider() now checks for a provider#providername#enabled variable. It is up to the provider script to set this to 0 or 1 accordingly. eval_call_provider() remains unchanged. All providers hosting a Call function were updated to respect this. The clipboard provider now has a Reload function to reload the provider.
This commit is contained in:

committed by
Justin M. Keyes

parent
2860453c4f
commit
2cfe4748e5
@@ -10,6 +10,7 @@ endif
|
||||
let g:loaded_python_provider = 1
|
||||
|
||||
let [s:prog, s:err] = provider#pythonx#Detect(2)
|
||||
let g:provider#python#enabled = !empty(s:prog)
|
||||
|
||||
function! provider#python#Prog() abort
|
||||
return s:prog
|
||||
@@ -19,11 +20,6 @@ function! provider#python#Error() abort
|
||||
return s:err
|
||||
endfunction
|
||||
|
||||
if s:prog == ''
|
||||
" Detection failed
|
||||
finish
|
||||
endif
|
||||
|
||||
" The Python provider plugin will run in a separate instance of the Python
|
||||
" host.
|
||||
call remote#host#RegisterClone('legacy-python-provider', 'python')
|
||||
|
Reference in New Issue
Block a user