aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
authorMathias Fußenegger <mfussenegger@users.noreply.github.com>2021-09-28 18:19:19 +0200
committerGitHub <noreply@github.com>2021-09-28 09:19:19 -0700
commit19a77cd5a7cbd304e57118d6a09798223b6d2dbf (patch)
tree544e9b18033ce0ace7feaae20968db97c44c9eb2 /test/functional
parentff18a8bcc4749c7ee169b63ef05ac1238d2de26e (diff)
downloadrneovim-19a77cd5a7cbd304e57118d6a09798223b6d2dbf.tar.gz
rneovim-19a77cd5a7cbd304e57118d6a09798223b6d2dbf.tar.bz2
rneovim-19a77cd5a7cbd304e57118d6a09798223b6d2dbf.zip
feat(lsp): add client command support to codelens (#15820)
Also adds a check against the server capabilities to fix https://github.com/neovim/neovim/issues/15183
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/plugin/lsp/codelens_spec.lua28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/functional/plugin/lsp/codelens_spec.lua b/test/functional/plugin/lsp/codelens_spec.lua
index e48a0ad260..c8b75e65fc 100644
--- a/test/functional/plugin/lsp/codelens_spec.lua
+++ b/test/functional/plugin/lsp/codelens_spec.lua
@@ -58,5 +58,33 @@ describe('vim.lsp.codelens', function()
]], bufnr)
eq({[1] = {'Lens1', 'LspCodeLens'}}, virtual_text_chunks)
+
+ end)
+ it('codelens uses client commands', function()
+ local fake_uri = "file:///fake/uri"
+ local cmd = exec_lua([[
+ fake_uri = ...
+ local bufnr = vim.uri_to_bufnr(fake_uri)
+ vim.fn.bufload(bufnr)
+ vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, {'One line'})
+ local lenses = {
+ {
+ range = {
+ start = { line = 0, character = 0, },
+ ['end'] = { line = 0, character = 8 }
+ },
+ command = { title = 'Lens1', command = 'Dummy' }
+ },
+ }
+ vim.lsp.codelens.on_codelens(nil, lenses, {method='textDocument/codeLens', client_id=1, bufnr=bufnr})
+ local cmd_called = nil
+ vim.lsp.commands['Dummy'] = function(command)
+ cmd_called = command
+ end
+ vim.api.nvim_set_current_buf(bufnr)
+ vim.lsp.codelens.run()
+ return cmd_called
+ ]], fake_uri)
+ eq({ command = 'Dummy', title = 'Lens1' }, cmd)
end)
end)