aboutsummaryrefslogtreecommitdiff
path: root/runtime/autoload
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-08-04 15:52:56 +0200
committerGitHub <noreply@github.com>2019-08-04 15:52:56 +0200
commit96be8a2c4d63faadb97c346abb336511a60ac89a (patch)
tree71167260e69f87566391af2b1a8924987e6fe1d7 /runtime/autoload
parent2860453c4f9ad6abd7a967f9278401ae84a927e2 (diff)
parent2141dc22625f73f3ce73460e581934b94f141cf9 (diff)
downloadrneovim-96be8a2c4d63faadb97c346abb336511a60ac89a.tar.gz
rneovim-96be8a2c4d63faadb97c346abb336511a60ac89a.tar.bz2
rneovim-96be8a2c4d63faadb97c346abb336511a60ac89a.zip
Merge #10161 from equalsraf/tb-clipboard-reload
Support "reload" of providers
Diffstat (limited to 'runtime/autoload')
-rw-r--r--runtime/autoload/health/nvim.vim2
-rw-r--r--runtime/autoload/provider/clipboard.vim20
-rw-r--r--runtime/autoload/provider/node.vim3
-rw-r--r--runtime/autoload/provider/python.vim8
-rw-r--r--runtime/autoload/provider/python3.vim8
-rw-r--r--runtime/autoload/provider/ruby.vim3
6 files changed, 20 insertions, 24 deletions
diff --git a/runtime/autoload/health/nvim.vim b/runtime/autoload/health/nvim.vim
index a2227e3b29..c25f5ee64f 100644
--- a/runtime/autoload/health/nvim.vim
+++ b/runtime/autoload/health/nvim.vim
@@ -123,7 +123,7 @@ function! s:check_performance() abort
else
call health#report_info(buildtype)
call health#report_warn(
- \ 'Non-optimized build-type. Nvim will be slower.',
+ \ 'Non-optimized '.(has('debug')?'(DEBUG) ':'').'build. Nvim will be slower.',
\ ['Install a different Nvim package, or rebuild with `CMAKE_BUILD_TYPE=RelWithDebInfo`.',
\ s:suggest_faq])
endif
diff --git a/runtime/autoload/provider/clipboard.vim b/runtime/autoload/provider/clipboard.vim
index 2b06ee8c48..ce140b0948 100644
--- a/runtime/autoload/provider/clipboard.vim
+++ b/runtime/autoload/provider/clipboard.vim
@@ -1,6 +1,16 @@
" The clipboard provider uses shell commands to communicate with the clipboard.
" The provider function will only be registered if a supported command is
" available.
+
+if exists('g:loaded_clipboard_provider')
+ finish
+endif
+" Default to 1. provider#clipboard#Executable() may set 2.
+" To force a reload:
+" :unlet g:loaded_clipboard_provider
+" :runtime autoload/provider/clipboard.vim
+let g:loaded_clipboard_provider = 1
+
let s:copy = {}
let s:paste = {}
let s:clipboard = {}
@@ -120,13 +130,6 @@ 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
-
function! s:clipboard.get(reg) abort
if type(s:paste[a:reg]) == v:t_func
return s:paste[a:reg]()
@@ -192,3 +195,6 @@ function! provider#clipboard#Call(method, args) abort
let s:here = v:false
endtry
endfunction
+
+" eval_has_provider() decides based on this variable.
+let g:loaded_clipboard_provider = empty(provider#clipboard#Executable()) ? 1 : 2
diff --git a/runtime/autoload/provider/node.vim b/runtime/autoload/provider/node.vim
index 35882849bd..b2a3b3ee08 100644
--- a/runtime/autoload/provider/node.vim
+++ b/runtime/autoload/provider/node.vim
@@ -140,8 +140,9 @@ endfunction
let s:err = ''
let s:prog = provider#node#Detect()
+let g:loaded_node_provider = empty(s:prog) ? 1 : 2
-if empty(s:prog)
+if g:loaded_node_provider != 2
let s:err = 'Cannot find the "neovim" node package. Try :checkhealth'
endif
diff --git a/runtime/autoload/provider/python.vim b/runtime/autoload/provider/python.vim
index a06cbe4814..8a1d162784 100644
--- a/runtime/autoload/provider/python.vim
+++ b/runtime/autoload/provider/python.vim
@@ -7,9 +7,8 @@
if exists('g:loaded_python_provider')
finish
endif
-let g:loaded_python_provider = 1
-
let [s:prog, s:err] = provider#pythonx#Detect(2)
+let g:loaded_python_provider = empty(s:prog) ? 1 : 2
function! provider#python#Prog() abort
return s:prog
@@ -19,11 +18,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..38ef0cccfc 100644
--- a/runtime/autoload/provider/python3.vim
+++ b/runtime/autoload/provider/python3.vim
@@ -7,9 +7,8 @@
if exists('g:loaded_python3_provider')
finish
endif
-let g:loaded_python3_provider = 1
-
let [s:prog, s:err] = provider#pythonx#Detect(3)
+let g:loaded_python3_provider = empty(s:prog) ? 1 : 2
function! provider#python3#Prog() abort
return s:prog
@@ -19,11 +18,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..f843050df9 100644
--- a/runtime/autoload/provider/ruby.vim
+++ b/runtime/autoload/provider/ruby.vim
@@ -62,8 +62,9 @@ endfunction
let s:err = ''
let s:prog = s:detect()
let s:plugin_path = expand('<sfile>:p:h') . '/script_host.rb'
+let g:loaded_ruby_provider = empty(s:prog) ? 1 : 2
-if empty(s:prog)
+if g:loaded_ruby_provider != 2
let s:err = 'Cannot find the neovim RubyGem. Try :checkhealth'
endif