aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/autoload/provider/clipboard.vim16
-rw-r--r--runtime/autoload/provider/node.vim4
-rw-r--r--runtime/autoload/provider/python.vim6
-rw-r--r--runtime/autoload/provider/python3.vim6
-rw-r--r--runtime/autoload/provider/ruby.vim3
-rw-r--r--runtime/doc/develop.txt6
6 files changed, 22 insertions, 19 deletions
diff --git a/runtime/autoload/provider/clipboard.vim b/runtime/autoload/provider/clipboard.vim
index 2b06ee8c48..e43f8fbb7a 100644
--- a/runtime/autoload/provider/clipboard.vim
+++ b/runtime/autoload/provider/clipboard.vim
@@ -48,6 +48,9 @@ endfunction
let s:cache_enabled = 1
let s:err = ''
+" eval_has_provider checks the variable to verify provider status
+let g:provider#clipboard#enabled = 0
+
function! provider#clipboard#Error() abort
return s:err
endfunction
@@ -120,12 +123,11 @@ function! provider#clipboard#Executable() abort
return ''
endfunction
-if empty(provider#clipboard#Executable())
- " provider#clipboard#Call() *must not* be defined if the provider is broken.
- " Otherwise eval_has_provider() thinks the clipboard provider is
- " functioning, and eval_call_provider() will happily call it.
- finish
-endif
+" Call this to setup/reload the provider
+function! provider#clipboard#Reload()
+ " #enabled is used by eval_has_provider()
+ let g:provider#clipboard#enabled = !empty(provider#clipboard#Executable())
+endfunction
function! s:clipboard.get(reg) abort
if type(s:paste[a:reg]) == v:t_func
@@ -192,3 +194,5 @@ function! provider#clipboard#Call(method, args) abort
let s:here = v:false
endtry
endfunction
+
+call provider#clipboard#Reload()
diff --git a/runtime/autoload/provider/node.vim b/runtime/autoload/provider/node.vim
index 35882849bd..6413720605 100644
--- a/runtime/autoload/provider/node.vim
+++ b/runtime/autoload/provider/node.vim
@@ -2,6 +2,7 @@ if exists('g:loaded_node_provider')
finish
endif
let g:loaded_node_provider = 1
+let g:provider#node#enabled = 0
function! s:is_minimum_version(version, min_major, min_minor) abort
if empty(a:version)
@@ -143,6 +144,9 @@ let s:prog = provider#node#Detect()
if empty(s:prog)
let s:err = 'Cannot find the "neovim" node package. Try :checkhealth'
+else
+ let g:provider#node#enabled = 1
endif
call remote#host#RegisterPlugin('node-provider', 'node', [])
+
diff --git a/runtime/autoload/provider/python.vim b/runtime/autoload/provider/python.vim
index a06cbe4814..d65506a55a 100644
--- a/runtime/autoload/provider/python.vim
+++ b/runtime/autoload/provider/python.vim
@@ -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')
diff --git a/runtime/autoload/provider/python3.vim b/runtime/autoload/provider/python3.vim
index 242a224cb3..469611c7ce 100644
--- a/runtime/autoload/provider/python3.vim
+++ b/runtime/autoload/provider/python3.vim
@@ -10,6 +10,7 @@ endif
let g:loaded_python3_provider = 1
let [s:prog, s:err] = provider#pythonx#Detect(3)
+let g:provider#python3#enabled = !empty(s:prog)
function! provider#python3#Prog() abort
return s:prog
@@ -19,11 +20,6 @@ function! provider#python3#Error() abort
return s:err
endfunction
-if s:prog == ''
- " Detection failed
- finish
-endif
-
" The Python3 provider plugin will run in a separate instance of the Python3
" host.
call remote#host#RegisterClone('legacy-python3-provider', 'python3')
diff --git a/runtime/autoload/provider/ruby.vim b/runtime/autoload/provider/ruby.vim
index 3b4c6c4839..df43dffa40 100644
--- a/runtime/autoload/provider/ruby.vim
+++ b/runtime/autoload/provider/ruby.vim
@@ -7,6 +7,7 @@ let g:loaded_ruby_provider = 1
function! provider#ruby#Detect() abort
return s:prog
endfunction
+let g:provider#ruby#enabled = 0
function! provider#ruby#Prog() abort
return s:prog
@@ -65,6 +66,8 @@ let s:plugin_path = expand('<sfile>:p:h') . '/script_host.rb'
if empty(s:prog)
let s:err = 'Cannot find the neovim RubyGem. Try :checkhealth'
+else
+ let g:provider#ruby#enabled = 1
endif
call remote#host#RegisterClone('legacy-ruby-provider', 'ruby')
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.