aboutsummaryrefslogtreecommitdiff
path: root/test/functional/fixtures/fake-lsp-server.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/fixtures/fake-lsp-server.lua')
-rw-r--r--test/functional/fixtures/fake-lsp-server.lua74
1 files changed, 59 insertions, 15 deletions
diff --git a/test/functional/fixtures/fake-lsp-server.lua b/test/functional/fixtures/fake-lsp-server.lua
index aa47198f7a..0db9265a29 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')
@@ -787,6 +788,9 @@ function tests.code_action_server_side_command()
codeActionProvider = {
resolveProvider = false,
},
+ executeCommandProvider = {
+ commands = {"dummy1"}
+ },
},
}
end,
@@ -830,21 +834,21 @@ function tests.code_action_filter()
isPreferred = true,
command = 'preferred_command',
}
- local quickfix_action = {
+ local type_annotate_action = {
title = 'Action 3',
- kind = 'quickfix',
- command = 'quickfix_command',
+ kind = 'type-annotate',
+ command = 'type_annotate_command',
}
- local quickfix_foo_action = {
+ local type_annotate_foo_action = {
title = 'Action 4',
- kind = 'quickfix.foo',
- command = 'quickfix_foo_command',
+ kind = 'type-annotate.foo',
+ command = 'type_annotate_foo_command',
}
expect_request('textDocument/codeAction', function()
- return nil, { action, preferred_action, quickfix_action, quickfix_foo_action, }
+ return nil, { action, preferred_action, type_annotate_action, type_annotate_foo_action, }
end)
expect_request('textDocument/codeAction', function()
- return nil, { action, preferred_action, quickfix_action, quickfix_foo_action, }
+ return nil, { action, preferred_action, type_annotate_action, type_annotate_foo_action, }
end)
notify('shutdown')
end;
@@ -927,10 +931,53 @@ function tests.basic_formatting()
}
end
--- Tests will be indexed by TEST_NAME
+function tests.set_defaults_all_capabilities()
+ skeleton {
+ on_init = function(_)
+ return {
+ capabilities = {
+ definitionProvider = true,
+ completionProvider = true,
+ documentRangeFormattingProvider = true,
+ hoverProvider = true,
+ }
+ }
+ end;
+ body = function()
+ notify('test')
+ end;
+ }
+end
+
+function tests.inlay_hint()
+ skeleton {
+ on_init = function(params)
+ local expected_capabilities = protocol.make_client_capabilities()
+ assert_eq(params.capabilities, expected_capabilities)
+ return {
+ capabilities = {
+ inlayHintProvider = true;
+ }
+ }
+ end;
+ body = function()
+ notify('start')
+ expect_request('textDocument/inlayHint', function()
+ return nil, {}
+ end)
+ expect_notification("finish")
+ notify('finish')
+ end;
+ }
+end
+
+-- Tests will be indexed by test_name
+local test_name = arg[1]
+local timeout = arg[2]
+assert(type(test_name) == 'string', 'test_name must be specified as first arg.')
-local kill_timer = vim.loop.new_timer()
-kill_timer:start(_G.TIMEOUT or 1e3, 0, function()
+local kill_timer = vim.uv.new_timer()
+kill_timer:start(timeout or 1e3, 0, function()
kill_timer:stop()
kill_timer:close()
log('ERROR', 'LSP', 'TIMEOUT')
@@ -938,14 +985,11 @@ kill_timer:start(_G.TIMEOUT or 1e3, 0, function()
os.exit(100)
end)
-local test_name = _G.TEST_NAME -- lualint workaround
-assert(type(test_name) == 'string', 'TEST_NAME must be specified.')
local status, err = pcall(assert(tests[test_name], "Test not found"))
kill_timer:stop()
kill_timer:close()
if not status then
log('ERROR', 'LSP', tostring(err))
io.stderr:write(err)
- os.exit(101)
+ vim.cmd [[101cquit]]
end
-os.exit(0)