diff options
author | Daniel Hahler <git@thequod.de> | 2019-10-04 08:16:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-04 08:16:30 +0200 |
commit | 382391bb2de4698feb05e4c8e6c8286ccc4eaa8c (patch) | |
tree | 872bbcc95979f2ca928d8864cfb1199ce6858a28 | |
parent | c3ae5e13753e1b27324f167bdc7fab94a86ca294 (diff) | |
download | rneovim-382391bb2de4698feb05e4c8e6c8286ccc4eaa8c.tar.gz rneovim-382391bb2de4698feb05e4c8e6c8286ccc4eaa8c.tar.bz2 rneovim-382391bb2de4698feb05e4c8e6c8286ccc4eaa8c.zip |
health: provider: skip checks with `g:loaded_X_provider = 0` (#11147)
The Python provider was special (via [1]), and would continue to do
checks with `0` being set explicitly even.
This was fixed in #11044 (45447e3b6), ref: #11040.
This extends it to use the same method with all providers.
1: https://github.com/neovim/neovim/pull/8047
-rw-r--r-- | runtime/autoload/health/provider.vim | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/runtime/autoload/health/provider.vim b/runtime/autoload/health/provider.vim index 61858193c3..c750a954fa 100644 --- a/runtime/autoload/health/provider.vim +++ b/runtime/autoload/health/provider.vim @@ -265,6 +265,22 @@ function! s:check_bin(bin) abort return 1 endfunction +" Check "loaded" var for given a:provider. +" Returns 1 if the caller should return (skip checks). +function! s:disabled_via_loaded_var(provider) abort + let loaded_var = 'g:loaded_'.a:provider.'_provider' + if exists(loaded_var) && !exists('*provider#'.a:provider.'#Call') + let v = eval(loaded_var) + if 0 is v + call health#report_info('Disabled ('.loaded_var.'='.v.').') + return 1 + else + call health#report_info('Disabled ('.loaded_var.'='.v.'). This might be due to some previous error.') + endif + endif + return 0 +endfunction + function! s:check_python(version) abort call health#report_start('Python ' . a:version . ' provider (optional)') @@ -272,15 +288,10 @@ function! s:check_python(version) abort let python_exe = '' let venv = exists('$VIRTUAL_ENV') ? resolve($VIRTUAL_ENV) : '' let host_prog_var = pyname.'_host_prog' - let loaded_var = 'g:loaded_'.pyname.'_provider' let python_multiple = [] - if exists(loaded_var) && !exists('*provider#'.pyname.'#Call') - let v = eval(loaded_var) - call health#report_info('Disabled ('.loaded_var.'='.v.').'.(0 is v ? '' : ' This might be due to some previous error.')) - if 0 is v - return - endif + if s:disabled_via_loaded_var(pyname) + return endif let [pyenv, pyenv_root] = s:check_for_pyenv() @@ -488,9 +499,7 @@ endfunction function! s:check_ruby() abort call health#report_start('Ruby provider (optional)') - let loaded_var = 'g:loaded_ruby_provider' - if exists(loaded_var) && !exists('*provider#ruby#Call') - call health#report_info('Disabled. '.loaded_var.'='.eval(loaded_var)) + if s:disabled_via_loaded_var('ruby') return endif @@ -544,9 +553,7 @@ endfunction function! s:check_node() abort call health#report_start('Node.js provider (optional)') - let loaded_var = 'g:loaded_node_provider' - if exists(loaded_var) && !exists('*provider#node#Call') - call health#report_info('Disabled. '.loaded_var.'='.eval(loaded_var)) + if s:disabled_via_loaded_var('node') return endif |