LSP: fix validate_client_config
- `cmd_env` is a table not a function. - tests: Set $NVIM_LOG_FILE for fake LSP server.
This commit is contained in:
parent
c15bd6cd27
commit
1eb0f5371a
|
@ -154,7 +154,7 @@ local function validate_client_config(config)
|
|||
callbacks = { config.callbacks, "t", true };
|
||||
capabilities = { config.capabilities, "t", true };
|
||||
cmd_cwd = { config.cmd_cwd, optional_validator(is_dir), "directory" };
|
||||
cmd_env = { config.cmd_env, "f", true };
|
||||
cmd_env = { config.cmd_env, "t", true };
|
||||
name = { config.name, 's', true };
|
||||
on_error = { config.on_error, "f", true };
|
||||
on_exit = { config.on_exit, "f", true };
|
||||
|
|
|
@ -16,16 +16,16 @@ local run, stop = helpers.run, helpers.stop
|
|||
|
||||
if helpers.pending_win32(pending) then return end
|
||||
|
||||
local fake_lsp_server_file = "test/functional/fixtures/lsp-test-rpc-server.lua"
|
||||
if iswin() then
|
||||
fake_lsp_server_file = fake_lsp_server_file:gsub("/", "\\")
|
||||
end
|
||||
local fake_lsp_server_file = 'test/functional/fixtures/fake-lsp-server.lua'
|
||||
|
||||
local function fake_lsp_server_setup(test_name, timeout_ms)
|
||||
exec_lua([=[
|
||||
lsp = require('vim.lsp')
|
||||
local test_name, fixture_filename, timeout = ...
|
||||
TEST_RPC_CLIENT_ID = lsp.start_client {
|
||||
cmd_env = {
|
||||
NVIM_LOG_FILE = 'Xtest-fake-lsp-server.log'
|
||||
};
|
||||
cmd = {
|
||||
vim.v.progpath, '-Es', '-u', 'NONE', '--headless',
|
||||
"-c", string.format("lua TEST_NAME = %q", test_name),
|
||||
|
@ -117,6 +117,9 @@ describe('LSP', function()
|
|||
local test_name, fixture_filename = ...
|
||||
function test__start_client()
|
||||
return lsp.start_client {
|
||||
cmd_env = {
|
||||
NVIM_LOG_FILE = 'Xtest-fake-lsp-server.log'
|
||||
};
|
||||
cmd = {
|
||||
vim.v.progpath, '-Es', '-u', 'NONE', '--headless',
|
||||
"-c", string.format("lua TEST_NAME = %q", test_name),
|
||||
|
@ -217,7 +220,7 @@ describe('LSP', function()
|
|||
client.stop()
|
||||
end;
|
||||
on_exit = function(code, signal)
|
||||
eq(101, code, "exit code")
|
||||
eq(101, code, "exit code") -- See fake-lsp-server.lua
|
||||
eq(0, signal, "exit signal")
|
||||
end;
|
||||
on_callback = function(...)
|
||||
|
|
Loading…
Reference in New Issue