aboutsummaryrefslogtreecommitdiff
path: root/test/functional/plugin/lsp/lsp_spec.lua
diff options
context:
space:
mode:
authorHirokazu Hata <h.hata.ai.t@gmail.com>2019-12-29 02:28:00 +0900
committerAshkan Kiani <ashkan.k.kiani@gmail.com>2019-12-28 09:28:00 -0800
commit680693e263576e34d5947c43ab0ae3ff0ebfeab5 (patch)
treedbe9427c527791ad2ca1185de3cb83ef010cf10b /test/functional/plugin/lsp/lsp_spec.lua
parent4f4c06a7a46e13e59381183818e839691b55702b (diff)
downloadrneovim-680693e263576e34d5947c43ab0ae3ff0ebfeab5.tar.gz
rneovim-680693e263576e34d5947c43ab0ae3ff0ebfeab5.tar.bz2
rneovim-680693e263576e34d5947c43ab0ae3ff0ebfeab5.zip
runtime: Add vim.lsp.get_client_by_name (#11603)
Since the client name is more obvious than the client id for the user, add an API to get the lsp client by the client name.
Diffstat (limited to 'test/functional/plugin/lsp/lsp_spec.lua')
-rw-r--r--test/functional/plugin/lsp/lsp_spec.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/functional/plugin/lsp/lsp_spec.lua b/test/functional/plugin/lsp/lsp_spec.lua
index f10fd5c185..99240ebed6 100644
--- a/test/functional/plugin/lsp/lsp_spec.lua
+++ b/test/functional/plugin/lsp/lsp_spec.lua
@@ -111,6 +111,7 @@ describe('Language Client API', function()
exec_lua([=[
lsp = require('vim.lsp')
local test_name, fixture_filename = ...
+ TEST_NAME = test_name
TEST_RPC_CLIENT_ID = lsp.start_client {
cmd = {
vim.api.nvim_get_vvar("progpath"), '-Es', '-u', 'NONE', '--headless',
@@ -118,6 +119,7 @@ describe('Language Client API', function()
"-c", "luafile "..fixture_filename;
};
root_dir = vim.loop.cwd();
+ name = test_name;
}
]=], test_name, lsp_test_rpc_server_file)
end)
@@ -137,6 +139,7 @@ describe('Language Client API', function()
end
eq(1, exec_lua("return #lsp.get_active_clients()"))
eq(false, exec_lua("return lsp.get_client_by_id(TEST_RPC_CLIENT_ID) == nil"))
+ eq(false, exec_lua("return lsp.get_client_by_name(TEST_NAME) == nil"))
eq(false, exec_lua("return lsp.get_client_by_id(TEST_RPC_CLIENT_ID).is_stopped()"))
exec_lua("return lsp.get_client_by_id(TEST_RPC_CLIENT_ID).stop()")
for _ = 1, 20 do
@@ -146,6 +149,7 @@ describe('Language Client API', function()
end
end
eq(true, exec_lua("return lsp.get_client_by_id(TEST_RPC_CLIENT_ID) == nil"))
+ eq(true, exec_lua("return lsp.get_client_by_name(TEST_NAME) == nil"))
end)
end)
end)