aboutsummaryrefslogtreecommitdiff
path: root/test/functional/plugin
diff options
context:
space:
mode:
authorMaria José Solano <majosolano99@gmail.com>2025-03-06 00:21:47 -0800
committerGitHub <noreply@github.com>2025-03-06 08:21:47 +0000
commit41b07b128ccbdc445c3a56618b0c6ec6ed0f3438 (patch)
tree68a238a3973f489da9987d404204eca78b43b778 /test/functional/plugin
parent0c0352783fca7e9c56cd5ca8253834fee77c9d59 (diff)
downloadrneovim-41b07b128ccbdc445c3a56618b0c6ec6ed0f3438.tar.gz
rneovim-41b07b128ccbdc445c3a56618b0c6ec6ed0f3438.tar.bz2
rneovim-41b07b128ccbdc445c3a56618b0c6ec6ed0f3438.zip
feat(lsp): support for resolving code action command (#32704)
* fix(lsp): don't call codeAction_resolve with commands * feat(lsp): support for resolving code action command
Diffstat (limited to 'test/functional/plugin')
-rw-r--r--test/functional/plugin/lsp_spec.lua45
1 files changed, 45 insertions, 0 deletions
diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua
index 17e3fbbf70..33dfae6b12 100644
--- a/test/functional/plugin/lsp_spec.lua
+++ b/test/functional/plugin/lsp_spec.lua
@@ -4591,6 +4591,51 @@ describe('LSP', function()
eq('workspace/executeCommand', result[5].method)
eq('command:1', result[5].params.command)
end)
+
+ it('Resolves command property', function()
+ clear()
+ exec_lua(create_server_definition)
+ local result = exec_lua(function()
+ local server = _G._create_server({
+ capabilities = {
+ executeCommandProvider = {
+ commands = { 'command:1' },
+ },
+ codeActionProvider = {
+ resolveProvider = true,
+ },
+ },
+ handlers = {
+ ['textDocument/codeAction'] = function(_, _, callback)
+ callback(nil, {
+ { title = 'Code Action 1' },
+ })
+ end,
+ ['codeAction/resolve'] = function(_, _, callback)
+ callback(nil, {
+ title = 'Code Action 1',
+ command = {
+ title = 'Command 1',
+ command = 'command:1',
+ },
+ })
+ end,
+ },
+ })
+
+ local client_id = assert(vim.lsp.start({
+ name = 'dummy',
+ cmd = server.cmd,
+ }))
+
+ vim.lsp.buf.code_action({ apply = true })
+ vim.lsp.stop_client(client_id)
+ return server.messages
+ end)
+ eq('codeAction/resolve', result[4].method)
+ eq('workspace/executeCommand', result[5].method)
+ eq('command:1', result[5].params.command)
+ end)
end)
describe('vim.lsp.commands', function()