Merge #30342 :checkhealth completion

This commit is contained in:
Justin M. Keyes 2024-09-11 03:01:48 -07:00 committed by GitHub
commit a30afeeb85
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 11 deletions

View File

@ -285,8 +285,8 @@ local path2name = function(path)
-- Remove everything up to the last /lua/ folder -- Remove everything up to the last /lua/ folder
path = path:gsub('^.*/lua/', '') path = path:gsub('^.*/lua/', '')
-- Remove the filename (health.lua) -- Remove the filename (health.lua) or (health/init.lua)
path = vim.fs.dirname(path) path = vim.fs.dirname(path:gsub('/init%.lua$', ''))
-- Change slashes to dots -- Change slashes to dots
path = path:gsub('/', '.') path = path:gsub('/', '.')

View File

@ -40,11 +40,22 @@ describe(':checkhealth', function()
matches('ERROR $VIM .* zub', curbuf_contents()) matches('ERROR $VIM .* zub', curbuf_contents())
end) end)
it('completions can be listed via getcompletion()', function() it('getcompletion()', function()
clear() clear { args = { '-u', 'NORC', '+set runtimepath+=test/functional/fixtures' } }
eq('vim.deprecated', getcompletion('vim', 'checkhealth')[1]) eq('vim.deprecated', getcompletion('vim', 'checkhealth')[1])
eq('vim.provider', getcompletion('vim.prov', 'checkhealth')[1]) eq('vim.provider', getcompletion('vim.prov', 'checkhealth')[1])
eq('vim.lsp', getcompletion('vim.ls', 'checkhealth')[1]) eq('vim.lsp', getcompletion('vim.ls', 'checkhealth')[1])
-- "test_plug/health/init.lua" should complete as "test_plug", not "test_plug.health". #30342
eq({
'test_plug',
'test_plug.full_render',
'test_plug.submodule',
'test_plug.submodule_empty',
'test_plug.success1',
'test_plug.success2',
}, getcompletion('test_plug', 'checkhealth'))
end) end)
it('completion checks for vim.health._complete() return type #28456', function() it('completion checks for vim.health._complete() return type #28456', function()
@ -57,11 +68,9 @@ describe(':checkhealth', function()
end) end)
end) end)
describe('health.vim', function() describe('vim.health', function()
before_each(function() before_each(function()
clear { args = { '-u', 'NORC' } } clear { args = { '-u', 'NORC', '+set runtimepath+=test/functional/fixtures' } }
-- Provides healthcheck functions
command('set runtimepath+=test/functional/fixtures')
end) end)
describe(':checkhealth', function() describe(':checkhealth', function()
@ -207,9 +216,7 @@ end)
describe(':checkhealth window', function() describe(':checkhealth window', function()
before_each(function() before_each(function()
clear { args = { '-u', 'NORC' } } clear { args = { '-u', 'NORC', '+set runtimepath+=test/functional/fixtures' } }
-- Provides healthcheck functions
command('set runtimepath+=test/functional/fixtures')
command('set nofoldenable nowrap laststatus=0') command('set nofoldenable nowrap laststatus=0')
end) end)