diff options
author | Mathias Fussenegger <f.mathias@zignar.net> | 2022-12-04 15:57:46 +0100 |
---|---|---|
committer | Mathias Fussenegger <f.mathias@zignar.net> | 2022-12-04 15:57:46 +0100 |
commit | 67e1390dc8eb584d26ae9c9634c05acb3b7e37ca (patch) | |
tree | 2594c7667f3aae0a13735d7ab41f4809244b525e /test/functional/plugin/lsp_spec.lua | |
parent | 48b84d6d6e795d4c4b73ed1ed11967435f11267b (diff) | |
download | rneovim-67e1390dc8eb584d26ae9c9634c05acb3b7e37ca.tar.gz rneovim-67e1390dc8eb584d26ae9c9634c05acb3b7e37ca.tar.bz2 rneovim-67e1390dc8eb584d26ae9c9634c05acb3b7e37ca.zip |
fix(lsp): call show_document with correct args
Closes https://github.com/neovim/neovim/issues/21177
Diffstat (limited to 'test/functional/plugin/lsp_spec.lua')
-rw-r--r-- | test/functional/plugin/lsp_spec.lua | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua index 90bd4290ed..79c83af5d9 100644 --- a/test/functional/plugin/lsp_spec.lua +++ b/test/functional/plugin/lsp_spec.lua @@ -2689,6 +2689,33 @@ describe('LSP', function() eq(10, pos.col) end) + it('jumps to a Location if focus is true via handler', function() + exec_lua(create_server_definition) + local result = exec_lua([[ + local server = _create_server() + local client_id = vim.lsp.start({ name = 'dummy', cmd = server.cmd }) + local result = { + uri = 'file:///fake/uri', + selection = { + start = { line = 0, character = 9 }, + ['end'] = { line = 0, character = 9 } + }, + takeFocus = true, + } + local ctx = { + client_id = client_id, + method = 'window/showDocument', + } + vim.lsp.handlers['window/showDocument'](nil, result, ctx) + vim.lsp.stop_client(client_id) + return { + cursor = vim.api.nvim_win_get_cursor(0) + } + ]]) + eq(1, result.cursor[1]) + eq(9, result.cursor[2]) + end) + it('jumps to a Location if focus not set', function() local pos = show_document(location(0, 9, 0, 9), nil, true) eq(1, pos.line) |