aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
authorMathias Fußenegger <mfussenegger@users.noreply.github.com>2023-03-01 15:33:13 +0100
committerGitHub <noreply@github.com>2023-03-01 15:33:13 +0100
commit896d672736b32a8f4a4fa51844b44f266dcdcc6c (patch)
tree9d1d76c626640a9aab6c0dd2782416e342342036 /test/functional
parentd66832c76d6fce1627c33ae60a1b8efec1e32bdd (diff)
downloadrneovim-896d672736b32a8f4a4fa51844b44f266dcdcc6c.tar.gz
rneovim-896d672736b32a8f4a4fa51844b44f266dcdcc6c.tar.bz2
rneovim-896d672736b32a8f4a4fa51844b44f266dcdcc6c.zip
fix(lsp): use buffer scheme for files not stored on disk (#22407)
Sending `didOpen` with a `file` scheme causes problems with some language servers because they expect the file to exist on disk. See https://github.com/microsoft/language-server-protocol/pull/1679
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/fixtures/fake-lsp-server.lua37
1 files changed, 21 insertions, 16 deletions
diff --git a/test/functional/fixtures/fake-lsp-server.lua b/test/functional/fixtures/fake-lsp-server.lua
index db0c8c0c3f..dbb66a42e8 100644
--- a/test/functional/fixtures/fake-lsp-server.lua
+++ b/test/functional/fixtures/fake-lsp-server.lua
@@ -272,6 +272,7 @@ function tests.text_document_save_did_open()
end;
body = function()
notify('start')
+ expect_notification('textDocument/didClose')
expect_notification('textDocument/didOpen')
expect_notification('textDocument/didSave')
notify('shutdown')
@@ -292,6 +293,8 @@ function tests.text_document_sync_save_bool()
end;
body = function()
notify('start')
+ expect_notification('textDocument/didClose')
+ expect_notification('textDocument/didOpen')
expect_notification('textDocument/didSave', {textDocument = { uri = "file://" }})
notify('shutdown')
end;
@@ -313,6 +316,8 @@ function tests.text_document_sync_save_includeText()
end;
body = function()
notify('start')
+ expect_notification('textDocument/didClose')
+ expect_notification('textDocument/didOpen')
expect_notification('textDocument/didSave', {
textDocument = {
uri = "file://"
@@ -459,7 +464,7 @@ function tests.basic_check_buffer_open()
textDocument = {
languageId = "";
text = table.concat({"testing"; "123"}, "\n") .. '\n';
- uri = "file://";
+ uri = "buffer://";
version = 0;
};
})
@@ -486,13 +491,13 @@ function tests.basic_check_buffer_open_and_change()
textDocument = {
languageId = "";
text = table.concat({"testing"; "123"}, "\n") .. '\n';
- uri = "file://";
+ uri = "buffer://";
version = 0;
};
})
expect_notification('textDocument/didChange', {
textDocument = {
- uri = "file://";
+ uri = "buffer://";
version = 3;
};
contentChanges = {
@@ -522,13 +527,13 @@ function tests.basic_check_buffer_open_and_change_noeol()
textDocument = {
languageId = "";
text = table.concat({"testing"; "123"}, "\n");
- uri = "file://";
+ uri = "buffer://";
version = 0;
};
})
expect_notification('textDocument/didChange', {
textDocument = {
- uri = "file://";
+ uri = "buffer://";
version = 3;
};
contentChanges = {
@@ -557,13 +562,13 @@ function tests.basic_check_buffer_open_and_change_multi()
textDocument = {
languageId = "";
text = table.concat({"testing"; "123"}, "\n") .. '\n';
- uri = "file://";
+ uri = "buffer://";
version = 0;
};
})
expect_notification('textDocument/didChange', {
textDocument = {
- uri = "file://";
+ uri = "buffer://";
version = 3;
};
contentChanges = {
@@ -572,7 +577,7 @@ function tests.basic_check_buffer_open_and_change_multi()
})
expect_notification('textDocument/didChange', {
textDocument = {
- uri = "file://";
+ uri = "buffer://";
version = 4;
};
contentChanges = {
@@ -602,13 +607,13 @@ function tests.basic_check_buffer_open_and_change_multi_and_close()
textDocument = {
languageId = "";
text = table.concat({"testing"; "123"}, "\n") .. '\n';
- uri = "file://";
+ uri = "buffer://";
version = 0;
};
})
expect_notification('textDocument/didChange', {
textDocument = {
- uri = "file://";
+ uri = "buffer://";
version = 3;
};
contentChanges = {
@@ -617,7 +622,7 @@ function tests.basic_check_buffer_open_and_change_multi_and_close()
})
expect_notification('textDocument/didChange', {
textDocument = {
- uri = "file://";
+ uri = "buffer://";
version = 4;
};
contentChanges = {
@@ -626,7 +631,7 @@ function tests.basic_check_buffer_open_and_change_multi_and_close()
})
expect_notification('textDocument/didClose', {
textDocument = {
- uri = "file://";
+ uri = "buffer://";
};
})
expect_notification("finish")
@@ -660,13 +665,13 @@ function tests.basic_check_buffer_open_and_change_incremental()
textDocument = {
languageId = "";
text = table.concat({"testing"; "123"}, "\n") .. '\n';
- uri = "file://";
+ uri = "buffer://";
version = 0;
};
})
expect_notification('textDocument/didChange', {
textDocument = {
- uri = "file://";
+ uri = "buffer://";
version = 3;
};
contentChanges = {
@@ -703,13 +708,13 @@ function tests.basic_check_buffer_open_and_change_incremental_editing()
textDocument = {
languageId = "";
text = table.concat({"testing"; "123"}, "\n");
- uri = "file://";
+ uri = "buffer://";
version = 0;
};
})
expect_notification('textDocument/didChange', {
textDocument = {
- uri = "file://";
+ uri = "buffer://";
version = 3;
};
contentChanges = {