diff options
author | Lewis Russell <lewis6991@gmail.com> | 2025-03-08 10:15:43 +0000 |
---|---|---|
committer | Lewis Russell <me@lewisr.dev> | 2025-03-12 09:06:28 +0000 |
commit | ed071672613bbd3d5b5e5618a12ca6975244ca9b (patch) | |
tree | 42271987fbce4601703056f3bf4a978c0c771033 /test | |
parent | c63e794b103ceaa0b9cf4cd6816422bb38abde7e (diff) | |
download | rneovim-ed071672613bbd3d5b5e5618a12ca6975244ca9b.tar.gz rneovim-ed071672613bbd3d5b5e5618a12ca6975244ca9b.tar.bz2 rneovim-ed071672613bbd3d5b5e5618a12ca6975244ca9b.zip |
fix(lsp): handle non-existent configs in lsp.config/enable
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/plugin/lsp_spec.lua | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua index f402ac7e8c..4863873699 100644 --- a/test/functional/plugin/lsp_spec.lua +++ b/test/functional/plugin/lsp_spec.lua @@ -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) |