aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/autoload/health.vim5
-rw-r--r--runtime/lua/vim/health.lua2
-rw-r--r--test/functional/plugin/health_spec.lua10
3 files changed, 16 insertions, 1 deletions
diff --git a/runtime/autoload/health.vim b/runtime/autoload/health.vim
index 1292e4344e..a693868381 100644
--- a/runtime/autoload/health.vim
+++ b/runtime/autoload/health.vim
@@ -171,6 +171,11 @@ function! s:get_healthcheck(plugin_names) abort
for v in values(healthchecks)
let output[v[0]] = v[1:]
endfor
+ try
+ " vim.health is not a healthcheck, skip it
+ call remove(output, 'vim')
+ catch
+ endtry
return output
endfunction
diff --git a/runtime/lua/vim/health.lua b/runtime/lua/vim/health.lua
index 67c5c3b37f..b875da0abc 100644
--- a/runtime/lua/vim/health.lua
+++ b/runtime/lua/vim/health.lua
@@ -41,6 +41,8 @@ M._complete = function()
vim.tbl_map(function(f)
unique[f] = true
end, names)
+ -- vim.health is this file, which is not a healthcheck
+ unique['vim'] = nil
return vim.tbl_keys(unique)
end
diff --git a/test/functional/plugin/health_spec.lua b/test/functional/plugin/health_spec.lua
index a9bd76ce24..ba66117fb1 100644
--- a/test/functional/plugin/health_spec.lua
+++ b/test/functional/plugin/health_spec.lua
@@ -5,7 +5,7 @@ local Screen = require('test.functional.ui.screen')
local clear = helpers.clear
local curbuf_contents = helpers.curbuf_contents
local command = helpers.command
-local eq = helpers.eq
+local eq, neq = helpers.eq, helpers.neq
local getcompletion = helpers.funcs.getcompletion
describe(':checkhealth', function()
@@ -37,6 +37,7 @@ describe(':checkhealth', function()
eq('nvim', getcompletion('nvim', 'checkhealth')[1])
eq('provider', getcompletion('prov', 'checkhealth')[1])
eq('vim.lsp', getcompletion('vim.ls', 'checkhealth')[1])
+ neq('vim', getcompletion('^vim', 'checkhealth')[1]) -- should not complete vim.health
end)
end)
@@ -242,6 +243,13 @@ describe('health.vim', function()
- ERROR: No healthcheck found for "non_existent_healthcheck" plugin.
]])
end)
+
+ it("does not use vim.health as a healtcheck", function()
+ -- vim.health is not a healthcheck
+ command("checkhealth vim")
+ helpers.expect([[
+ ERROR: No healthchecks found.]])
+ end)
end)
end)