mirror of
https://github.com/neovim/neovim.git
synced 2026-04-26 17:24:18 +00:00
fix(lsp): handle non-existent configs in lsp.config/enable
This commit is contained in:
committed by
Lewis Russell
parent
c63e794b10
commit
ed07167261
@@ -6370,5 +6370,35 @@ describe('LSP', function()
|
||||
)
|
||||
end)
|
||||
end)
|
||||
|
||||
it('validates config on attach', function()
|
||||
local tmp1 = t.tmpname(true)
|
||||
exec_lua(function()
|
||||
vim.lsp.log._set_filename(fake_lsp_logfile)
|
||||
end)
|
||||
|
||||
local function test_cfg(cfg, err)
|
||||
exec_lua(function()
|
||||
vim.lsp.config['foo'] = {}
|
||||
vim.lsp.config('foo', cfg)
|
||||
vim.lsp.enable('foo')
|
||||
vim.cmd.edit(assert(tmp1))
|
||||
vim.bo.filetype = 'foo'
|
||||
end)
|
||||
|
||||
retry(nil, 1000, function()
|
||||
assert_log(err, fake_lsp_logfile)
|
||||
end)
|
||||
end
|
||||
|
||||
test_cfg({
|
||||
cmd = { 'lolling' },
|
||||
}, 'cannot start foo due to config error: .* lolling is not executable')
|
||||
|
||||
test_cfg({
|
||||
cmd = { 'cat' },
|
||||
filetypes = true,
|
||||
}, 'cannot start foo due to config error: .* filetypes: expected table, got boolean')
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user