aboutsummaryrefslogtreecommitdiff
path: root/test/functional/fixtures/fake-lsp-server.lua
diff options
context:
space:
mode:
authorMathias Fußenegger <mfussenegger@users.noreply.github.com>2022-04-30 22:13:26 +0200
committerGitHub <noreply@github.com>2022-04-30 22:13:26 +0200
commit0344736aa698dc205f8f9f80609b7033308d39ca (patch)
tree099aa0fef01b37012de459129bffce46d32ecfed /test/functional/fixtures/fake-lsp-server.lua
parentcc27540560672c1586e17a9e39512074e770b005 (diff)
downloadrneovim-0344736aa698dc205f8f9f80609b7033308d39ca.tar.gz
rneovim-0344736aa698dc205f8f9f80609b7033308d39ca.tar.bz2
rneovim-0344736aa698dc205f8f9f80609b7033308d39ca.zip
fix(lsp): handle textDocumentSync.save bool capability (#18332)
Follow up to https://github.com/neovim/neovim/pull/17814
Diffstat (limited to 'test/functional/fixtures/fake-lsp-server.lua')
-rw-r--r--test/functional/fixtures/fake-lsp-server.lua50
1 files changed, 49 insertions, 1 deletions
diff --git a/test/functional/fixtures/fake-lsp-server.lua b/test/functional/fixtures/fake-lsp-server.lua
index 5403405905..79a29cd8d8 100644
--- a/test/functional/fixtures/fake-lsp-server.lua
+++ b/test/functional/fixtures/fake-lsp-server.lua
@@ -28,7 +28,10 @@ local function assert_eq(a, b, ...)
if not vim.deep_equal(a, b) then
error(message_parts(": ",
..., "assert_eq failed",
- string.format("left == %q, right == %q", vim.inspect(a), vim.inspect(b))
+ string.format("left == %q, right == %q",
+ table.concat(vim.split(vim.inspect(a), "\n"), ""),
+ table.concat(vim.split(vim.inspect(b), "\n"), "")
+ )
))
end
end
@@ -245,6 +248,51 @@ function tests.basic_check_capabilities()
}
end
+function tests.text_document_sync_save_bool()
+ skeleton {
+ on_init = function()
+ return {
+ capabilities = {
+ textDocumentSync = {
+ save = true
+ }
+ }
+ }
+ end;
+ body = function()
+ notify('start')
+ expect_notification('textDocument/didSave', {textDocument = { uri = "file://" }})
+ notify('shutdown')
+ end;
+ }
+end
+
+function tests.text_document_sync_save_includeText()
+ skeleton {
+ on_init = function()
+ return {
+ capabilities = {
+ textDocumentSync = {
+ save = {
+ includeText = true
+ }
+ }
+ }
+ }
+ end;
+ body = function()
+ notify('start')
+ expect_notification('textDocument/didSave', {
+ textDocument = {
+ uri = "file://"
+ },
+ text = "help me\n"
+ })
+ notify('shutdown')
+ end;
+ }
+end
+
function tests.capabilities_for_client_supports_method()
skeleton {
on_init = function(params)