diff options
author | Matthieu Coudron <teto@users.noreply.github.com> | 2021-01-01 23:52:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-01 23:52:48 +0100 |
commit | 48caf1df8581a9a9da9072f901411b918333952d (patch) | |
tree | c1dfa6befd03c69c8d70fcc67996905ce6faf091 /test | |
parent | 4a0a6f7bff64b03c80dd84444fc4dbddbe1065ad (diff) | |
parent | f3bbc92476df1112deb34b9c7408cd594ee47a50 (diff) | |
download | rneovim-48caf1df8581a9a9da9072f901411b918333952d.tar.gz rneovim-48caf1df8581a9a9da9072f901411b918333952d.tar.bz2 rneovim-48caf1df8581a9a9da9072f901411b918333952d.zip |
Merge pull request #13649 from mjlbach/move_from_nvim-lspconfig
LSP: Move workspace/configuration from nvim-lspconfig to core
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/fixtures/fake-lsp-server.lua | 17 | ||||
-rw-r--r-- | test/functional/plugin/lsp_spec.lua | 42 |
2 files changed, 59 insertions, 0 deletions
diff --git a/test/functional/fixtures/fake-lsp-server.lua b/test/functional/fixtures/fake-lsp-server.lua index a30eb748d0..252db88b6b 100644 --- a/test/functional/fixtures/fake-lsp-server.lua +++ b/test/functional/fixtures/fake-lsp-server.lua @@ -109,6 +109,23 @@ function tests.basic_init() } end +function tests.check_workspace_configuration() + skeleton { + on_init = function(_params) + return { capabilities = {} } + end; + body = function() + notify('start') + notify('workspace/configuration', { items = { + { section = "testSetting1" }; + { section = "testSetting2" }; + } }) + expect_notification('workspace/configuration', { true; vim.NIL}) + notify('shutdown') + end; + } +end + function tests.basic_check_capabilities() skeleton { on_init = function(params) diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua index f01d90bbeb..ec06cb0639 100644 --- a/test/functional/plugin/lsp_spec.lua +++ b/test/functional/plugin/lsp_spec.lua @@ -262,6 +262,48 @@ describe('LSP', function() } end) + it('client should return settings via workspace/configuration handler', function() + local expected_callbacks = { + {NIL, "shutdown", {}, 1}; + {NIL, "workspace/configuration", { items = { + { section = "testSetting1" }; + { section = "testSetting2" }; + }}, 1}; + {NIL, "start", {}, 1}; + } + local client + test_rpc_server { + test_name = "check_workspace_configuration"; + on_init = function(_client) + client = _client + end; + on_exit = function(code, signal) + eq(0, code, "exit code", fake_lsp_logfile) + eq(0, signal, "exit signal", fake_lsp_logfile) + end; + on_callback = function(err, method, params, client_id) + eq(table.remove(expected_callbacks), {err, method, params, client_id}, "expected callback") + if method == 'start' then + exec_lua([=[ + local client = vim.lsp.get_client_by_id(TEST_RPC_CLIENT_ID) + client.config.settings = { + testSetting1 = true; + testSetting2 = false; + }]=]) + end + if method == 'workspace/configuration' then + local result = exec_lua([=[ + local method, params = ... + return require'vim.lsp.handlers'['workspace/configuration'](err, method, params, TEST_RPC_CLIENT_ID)]=], method, params) + client.notify('workspace/configuration', result) + end + if method == 'shutdown' then + client.stop() + end + end; + } + end) + it('should verify capabilities sent', function() local expected_callbacks = { {NIL, "shutdown", {}, 1}; |