diff options
author | Rui Abreu Ferreira <raf-ep@gmx.com> | 2019-06-09 18:22:10 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2019-08-04 13:23:46 +0200 |
commit | 2cfe4748e57bd510b98ca81bd915f801f5a50bb5 (patch) | |
tree | 7fb2e4ce22b5c800a84c1408c5357e2035c4f296 /runtime/doc | |
parent | 2860453c4f9ad6abd7a967f9278401ae84a927e2 (diff) | |
download | rneovim-2cfe4748e57bd510b98ca81bd915f801f5a50bb5.tar.gz rneovim-2cfe4748e57bd510b98ca81bd915f801f5a50bb5.tar.bz2 rneovim-2cfe4748e57bd510b98ca81bd915f801f5a50bb5.zip |
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.
Diffstat (limited to 'runtime/doc')
-rw-r--r-- | runtime/doc/develop.txt | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/runtime/doc/develop.txt b/runtime/doc/develop.txt index 843e23ee54..0f9e17e697 100644 --- a/runtime/doc/develop.txt +++ b/runtime/doc/develop.txt @@ -111,7 +111,7 @@ functions in eval.c: - eval_call_provider(name, method, arguments): calls provider#(name)#Call with the method and arguments. - eval_has_provider(name): Checks if a provider is implemented. Returns true - if the provider#(name)#Call function is implemented. Called by |has()| + if the provider#(name)#enabled variable is not 0. Called by |has()| (vimscript) to check if features are available. The provider#(name)#Call function implements integration with an external @@ -119,8 +119,8 @@ system, because shell commands and |RPC| clients are easier to work with in vimscript. For example, the Python provider is implemented by the -autoload/provider/python.vim script; the provider#python#Call function is only -defined if a valid external Python host is found. That works well with the +autoload/provider/python.vim script; the variable provider#python#enabled is only +1 if a valid external Python host is found. That works well with the `has('python')` expression (normally used by Python plugins) because if the Python host isn't installed then the plugin will "think" it is running in a Vim compiled without the "+python" feature. |