mirror of
https://github.com/neovim/neovim
synced 2025-07-15 16:51:49 +00:00
fix(checkhealth): check g:loaded_xx_provider for all providers #33168
(cherry picked from commit 5f9f5bc04d
)
This commit is contained in:
committed by
github-actions[bot]
parent
2a04161a35
commit
fcee5df0fc
@ -107,9 +107,22 @@ local function provider_disabled(provider)
|
||||
return false
|
||||
end
|
||||
|
||||
--- Checks the hygiene of a `g:loaded_xx_provider` variable.
|
||||
local function check_loaded_var(var)
|
||||
if vim.g[var] == 1 then
|
||||
health.error(('`g:%s=1` may have been set by mistake.'):format(var), {
|
||||
('Remove `vim.g.%s=1` from your config.'):format(var),
|
||||
'To disable the provider, set this to 0, not 1.',
|
||||
'If you want to enable the provider but skip automatic detection, set the respective `g:…_host_prog` var. See :help provider',
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
local function clipboard()
|
||||
health.start('Clipboard (optional)')
|
||||
|
||||
check_loaded_var('loaded_clipboard_provider')
|
||||
|
||||
if
|
||||
os.getenv('TMUX')
|
||||
and vim.fn.executable('tmux') == 1
|
||||
@ -144,6 +157,8 @@ end
|
||||
local function node()
|
||||
health.start('Node.js provider (optional)')
|
||||
|
||||
check_loaded_var('loaded_node_provider')
|
||||
|
||||
if provider_disabled('node') then
|
||||
return
|
||||
end
|
||||
@ -247,6 +262,8 @@ end
|
||||
local function perl()
|
||||
health.start('Perl provider (optional)')
|
||||
|
||||
check_loaded_var('loaded_perl_provider')
|
||||
|
||||
if provider_disabled('perl') then
|
||||
return
|
||||
end
|
||||
@ -256,7 +273,7 @@ local function perl()
|
||||
if not perl_exec then
|
||||
health.warn(assert(perl_warnings), {
|
||||
'See :help provider-perl for more information.',
|
||||
'You may disable this provider (and warning) by adding `let g:loaded_perl_provider = 0` to your init.vim',
|
||||
'You can disable this provider (and warning) by adding `let g:loaded_perl_provider = 0` to your init.vim',
|
||||
})
|
||||
health.warn('No usable perl executable found')
|
||||
return
|
||||
@ -561,6 +578,8 @@ end
|
||||
local function python()
|
||||
health.start('Python 3 provider (optional)')
|
||||
|
||||
check_loaded_var('loaded_python3_provider')
|
||||
|
||||
local python_exe = ''
|
||||
local virtual_env = os.getenv('VIRTUAL_ENV')
|
||||
local venv = virtual_env and vim.fn.resolve(virtual_env) or ''
|
||||
@ -595,7 +614,7 @@ local function python()
|
||||
if pythonx_warnings then
|
||||
health.warn(pythonx_warnings, {
|
||||
'See :help provider-python for more information.',
|
||||
'You may disable this provider (and warning) by adding `let g:loaded_python3_provider = 0` to your init.vim',
|
||||
'You can disable this provider (and warning) by adding `let g:loaded_python3_provider = 0` to your init.vim',
|
||||
})
|
||||
elseif pyname and pyname ~= '' and python_exe == '' then
|
||||
if not vim.g[host_prog_var] then
|
||||
@ -840,6 +859,8 @@ end
|
||||
local function ruby()
|
||||
health.start('Ruby provider (optional)')
|
||||
|
||||
check_loaded_var('loaded_ruby_provider')
|
||||
|
||||
if provider_disabled('ruby') then
|
||||
return
|
||||
end
|
||||
@ -860,7 +881,7 @@ local function ruby()
|
||||
'Run `gem environment` to ensure the gem bin directory is in $PATH.',
|
||||
'If you are using rvm/rbenv/chruby, try "rehashing".',
|
||||
'See :help g:ruby_host_prog for non-standard gem installations.',
|
||||
'You may disable this provider (and warning) by adding `let g:loaded_ruby_provider = 0` to your init.vim',
|
||||
'You can disable this provider (and warning) by adding `let g:loaded_ruby_provider = 0` to your init.vim',
|
||||
})
|
||||
return
|
||||
end
|
||||
|
Reference in New Issue
Block a user