mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 12:27:24 +00:00
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:
@@ -154,7 +154,7 @@ local function validate_client_config(config)
|
|||||||
callbacks = { config.callbacks, "t", true };
|
callbacks = { config.callbacks, "t", true };
|
||||||
capabilities = { config.capabilities, "t", true };
|
capabilities = { config.capabilities, "t", true };
|
||||||
cmd_cwd = { config.cmd_cwd, optional_validator(is_dir), "directory" };
|
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 };
|
name = { config.name, 's', true };
|
||||||
on_error = { config.on_error, "f", true };
|
on_error = { config.on_error, "f", true };
|
||||||
on_exit = { config.on_exit, "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
|
if helpers.pending_win32(pending) then return end
|
||||||
|
|
||||||
local fake_lsp_server_file = "test/functional/fixtures/lsp-test-rpc-server.lua"
|
local fake_lsp_server_file = 'test/functional/fixtures/fake-lsp-server.lua'
|
||||||
if iswin() then
|
|
||||||
fake_lsp_server_file = fake_lsp_server_file:gsub("/", "\\")
|
|
||||||
end
|
|
||||||
|
|
||||||
local function fake_lsp_server_setup(test_name, timeout_ms)
|
local function fake_lsp_server_setup(test_name, timeout_ms)
|
||||||
exec_lua([=[
|
exec_lua([=[
|
||||||
lsp = require('vim.lsp')
|
lsp = require('vim.lsp')
|
||||||
local test_name, fixture_filename, timeout = ...
|
local test_name, fixture_filename, timeout = ...
|
||||||
TEST_RPC_CLIENT_ID = lsp.start_client {
|
TEST_RPC_CLIENT_ID = lsp.start_client {
|
||||||
|
cmd_env = {
|
||||||
|
NVIM_LOG_FILE = 'Xtest-fake-lsp-server.log'
|
||||||
|
};
|
||||||
cmd = {
|
cmd = {
|
||||||
vim.v.progpath, '-Es', '-u', 'NONE', '--headless',
|
vim.v.progpath, '-Es', '-u', 'NONE', '--headless',
|
||||||
"-c", string.format("lua TEST_NAME = %q", test_name),
|
"-c", string.format("lua TEST_NAME = %q", test_name),
|
||||||
@@ -117,6 +117,9 @@ describe('LSP', function()
|
|||||||
local test_name, fixture_filename = ...
|
local test_name, fixture_filename = ...
|
||||||
function test__start_client()
|
function test__start_client()
|
||||||
return lsp.start_client {
|
return lsp.start_client {
|
||||||
|
cmd_env = {
|
||||||
|
NVIM_LOG_FILE = 'Xtest-fake-lsp-server.log'
|
||||||
|
};
|
||||||
cmd = {
|
cmd = {
|
||||||
vim.v.progpath, '-Es', '-u', 'NONE', '--headless',
|
vim.v.progpath, '-Es', '-u', 'NONE', '--headless',
|
||||||
"-c", string.format("lua TEST_NAME = %q", test_name),
|
"-c", string.format("lua TEST_NAME = %q", test_name),
|
||||||
@@ -217,7 +220,7 @@ describe('LSP', function()
|
|||||||
client.stop()
|
client.stop()
|
||||||
end;
|
end;
|
||||||
on_exit = function(code, signal)
|
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")
|
eq(0, signal, "exit signal")
|
||||||
end;
|
end;
|
||||||
on_callback = function(...)
|
on_callback = function(...)
|
||||||
|
|||||||
Reference in New Issue
Block a user