aboutsummaryrefslogtreecommitdiff
path: root/test/functional/plugin/lsp_spec.lua
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2022-08-03 00:08:17 -0600
committerJosh Rahm <joshuarahm@gmail.com>2022-08-03 00:08:17 -0600
commit9449e1b8d273ff78eb894c588110ffa0c17d6ee3 (patch)
tree9e4470c33bd4187d9f42f0b2c4aaa995310c5be8 /test/functional/plugin/lsp_spec.lua
parent308e1940dcd64aa6c344c403d4f9e0dda58d9c5c (diff)
parentb8dcbcc732baf84fc48d6b272c3ade0bcb129b3b (diff)
downloadrneovim-9449e1b8d273ff78eb894c588110ffa0c17d6ee3.tar.gz
rneovim-9449e1b8d273ff78eb894c588110ffa0c17d6ee3.tar.bz2
rneovim-9449e1b8d273ff78eb894c588110ffa0c17d6ee3.zip
Merge remote-tracking branch 'upstream/master' into rahm
Diffstat (limited to 'test/functional/plugin/lsp_spec.lua')
-rw-r--r--test/functional/plugin/lsp_spec.lua40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua
index c166982052..cd7415de90 100644
--- a/test/functional/plugin/lsp_spec.lua
+++ b/test/functional/plugin/lsp_spec.lua
@@ -535,6 +535,46 @@ describe('LSP', function()
}
end)
+ it('saveas sends didOpen if filename changed', function()
+ local expected_handlers = {
+ { NIL, {}, { method = 'shutdown', client_id = 1 } },
+ { NIL, {}, { method = 'start', client_id = 1 } },
+ }
+ local client
+ test_rpc_server({
+ test_name = 'text_document_save_did_open',
+ on_init = function(c)
+ client = c
+ end,
+ on_exit = function(code, signal)
+ eq(0, code, 'exit code')
+ eq(0, signal, 'exit signal')
+ end,
+ on_handler = function(err, result, ctx)
+ eq(table.remove(expected_handlers), { err, result, ctx }, 'expected handler')
+ if ctx.method == 'start' then
+ local tmpfile_old = helpers.tmpname()
+ local tmpfile_new = helpers.tmpname()
+ os.remove(tmpfile_new)
+ exec_lua(
+ [=[
+ local oldname, newname = ...
+ BUFFER = vim.api.nvim_get_current_buf()
+ vim.api.nvim_buf_set_name(BUFFER, oldname)
+ vim.api.nvim_buf_set_lines(BUFFER, 0, -1, true, {"help me"})
+ lsp.buf_attach_client(BUFFER, TEST_RPC_CLIENT_ID)
+ vim.api.nvim_buf_call(BUFFER, function() vim.cmd('saveas ' .. newname) end)
+ ]=],
+ tmpfile_old,
+ tmpfile_new
+ )
+ else
+ client.stop()
+ end
+ end,
+ })
+ end)
+
it('BufWritePost sends didSave including text if server capability is set', function()
local expected_handlers = {
{NIL, {}, {method="shutdown", client_id=1}};