mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
fix(checkhealth): check g:loaded_xx_provider for all providers #33168
This commit is contained in:
@@ -110,16 +110,6 @@ local function check_config()
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
if vim.g.loaded_python3_provider == 1 then
|
|
||||||
ok = false
|
|
||||||
health.error(
|
|
||||||
'`g:loaded_python3_provider=1` may have been set by mistake. This option should not be used to load python provider in your config.',
|
|
||||||
{
|
|
||||||
'Remove `vim.g.loaded_python3_provider=1` from your config.',
|
|
||||||
}
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
local writeable = true
|
local writeable = true
|
||||||
local shadaopt = vim.fn.split(vim.o.shada, ',')
|
local shadaopt = vim.fn.split(vim.o.shada, ',')
|
||||||
local shadafile = (
|
local shadafile = (
|
||||||
|
@@ -107,9 +107,22 @@ local function provider_disabled(provider)
|
|||||||
return false
|
return false
|
||||||
end
|
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()
|
local function clipboard()
|
||||||
health.start('Clipboard (optional)')
|
health.start('Clipboard (optional)')
|
||||||
|
|
||||||
|
check_loaded_var('loaded_clipboard_provider')
|
||||||
|
|
||||||
if
|
if
|
||||||
os.getenv('TMUX')
|
os.getenv('TMUX')
|
||||||
and vim.fn.executable('tmux') == 1
|
and vim.fn.executable('tmux') == 1
|
||||||
@@ -144,6 +157,8 @@ end
|
|||||||
local function node()
|
local function node()
|
||||||
health.start('Node.js provider (optional)')
|
health.start('Node.js provider (optional)')
|
||||||
|
|
||||||
|
check_loaded_var('loaded_node_provider')
|
||||||
|
|
||||||
if provider_disabled('node') then
|
if provider_disabled('node') then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -247,6 +262,8 @@ end
|
|||||||
local function perl()
|
local function perl()
|
||||||
health.start('Perl provider (optional)')
|
health.start('Perl provider (optional)')
|
||||||
|
|
||||||
|
check_loaded_var('loaded_perl_provider')
|
||||||
|
|
||||||
if provider_disabled('perl') then
|
if provider_disabled('perl') then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -256,7 +273,7 @@ local function perl()
|
|||||||
if not perl_exec then
|
if not perl_exec then
|
||||||
health.warn(assert(perl_warnings), {
|
health.warn(assert(perl_warnings), {
|
||||||
'See :help provider-perl for more information.',
|
'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')
|
health.warn('No usable perl executable found')
|
||||||
return
|
return
|
||||||
@@ -561,6 +578,8 @@ end
|
|||||||
local function python()
|
local function python()
|
||||||
health.start('Python 3 provider (optional)')
|
health.start('Python 3 provider (optional)')
|
||||||
|
|
||||||
|
check_loaded_var('loaded_python3_provider')
|
||||||
|
|
||||||
local python_exe = ''
|
local python_exe = ''
|
||||||
local virtual_env = os.getenv('VIRTUAL_ENV')
|
local virtual_env = os.getenv('VIRTUAL_ENV')
|
||||||
local venv = virtual_env and vim.fn.resolve(virtual_env) or ''
|
local venv = virtual_env and vim.fn.resolve(virtual_env) or ''
|
||||||
@@ -595,7 +614,7 @@ local function python()
|
|||||||
if pythonx_warnings then
|
if pythonx_warnings then
|
||||||
health.warn(pythonx_warnings, {
|
health.warn(pythonx_warnings, {
|
||||||
'See :help provider-python for more information.',
|
'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
|
elseif pyname and pyname ~= '' and python_exe == '' then
|
||||||
if not vim.g[host_prog_var] then
|
if not vim.g[host_prog_var] then
|
||||||
@@ -840,6 +859,8 @@ end
|
|||||||
local function ruby()
|
local function ruby()
|
||||||
health.start('Ruby provider (optional)')
|
health.start('Ruby provider (optional)')
|
||||||
|
|
||||||
|
check_loaded_var('loaded_ruby_provider')
|
||||||
|
|
||||||
if provider_disabled('ruby') then
|
if provider_disabled('ruby') then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -860,7 +881,7 @@ local function ruby()
|
|||||||
'Run `gem environment` to ensure the gem bin directory is in $PATH.',
|
'Run `gem environment` to ensure the gem bin directory is in $PATH.',
|
||||||
'If you are using rvm/rbenv/chruby, try "rehashing".',
|
'If you are using rvm/rbenv/chruby, try "rehashing".',
|
||||||
'See :help g:ruby_host_prog for non-standard gem installations.',
|
'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
|
return
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user