aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/lsp.txt4
-rw-r--r--runtime/doc/ui.txt8
-rw-r--r--runtime/lua/vim/lsp/handlers.lua36
-rw-r--r--runtime/lua/vim/lsp/protocol.lua10
4 files changed, 50 insertions, 8 deletions
diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt
index 67e2815715..8e93b188e9 100644
--- a/runtime/doc/lsp.txt
+++ b/runtime/doc/lsp.txt
@@ -118,7 +118,7 @@ FAQ *lsp-faq*
<
*vim.lsp.callbacks*
- Q: What happened to `vim.lsp.callbacks`?
- A: After better defining the interface of |lsp-hander|s, we thought it best
+ A: After better defining the interface of |lsp-handler|s, we thought it best
to remove the generic usage of `callbacks` and transform to `handlers`.
Due to this, `vim.lsp.callbacks` was renamed to |vim.lsp.handlers|.
@@ -257,7 +257,7 @@ For |lsp-notification|, each |lsp-handler| has this signature: >
*lsp-handler-configuration*
-To configure the behavior of a builtin |lsp-handler|, the conenvience method
+To configure the behavior of a builtin |lsp-handler|, the convenient method
|vim.lsp.with()| is provided for users.
To configure the behavior of |vim.lsp.diagnostic.on_publish_diagnostics()|,
diff --git a/runtime/doc/ui.txt b/runtime/doc/ui.txt
index e5c6b9b1b7..0a8584927e 100644
--- a/runtime/doc/ui.txt
+++ b/runtime/doc/ui.txt
@@ -213,11 +213,9 @@ the editor.
["mouse_on"]
["mouse_off"]
- |'mouse'| was enabled/disabled in the current editor mode. Useful for
- a terminal UI, or other situations where Nvim mouse would conflict
- with other usages of the mouse. UIs may ignore this and always send
- mouse input, because 'mouse' decides the behavior of |nvim_input()|
- implicitly.
+ 'mouse' was enabled/disabled in the current editor mode. Useful for
+ a terminal UI, or embedding into an application where Nvim mouse would
+ conflict with other usages of the mouse. Other UI:s may ignore this event.
["busy_start"]
["busy_stop"]
diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua
index 359573beb1..fd23a6a547 100644
--- a/runtime/lua/vim/lsp/handlers.lua
+++ b/runtime/lua/vim/lsp/handlers.lua
@@ -63,8 +63,44 @@ local function progress_callback(_, _, params, client_id)
vim.api.nvim_command("doautocmd <nomodeline> User LspProgressUpdate")
end
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#progress
M['$/progress'] = progress_callback
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#window_workDoneProgress_create
+M['window/workDoneProgress/create'] = function(_, _, params, client_id)
+ local client = vim.lsp.get_client_by_id(client_id)
+ local token = params.token -- string or number
+ if not client then
+ err_message("LSP[", client_id, "] client has shut down after sending the message")
+ end
+ client.messages.progress[token] = {}
+ return vim.NIL
+end
+
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#window_showMessageRequest
+M['window/showMessageRequest'] = function(_, _, params)
+
+ local actions = params.actions
+ print(params.message)
+ local option_strings = {params.message, "\nRequest Actions:"}
+ for i, action in ipairs(actions) do
+ local title = action.title:gsub('\r\n', '\\r\\n')
+ title = title:gsub('\n', '\\n')
+ table.insert(option_strings, string.format("%d. %s", i, title))
+ end
+
+ -- window/showMessageRequest can return either MessageActionItem[] or null.
+ local choice = vim.fn.inputlist(option_strings)
+ if choice < 1 or choice > #actions then
+ return vim.NIL
+ else
+ local action_chosen = actions[choice]
+ return {
+ title = action_chosen;
+ }
+ end
+end
+
--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_codeAction
M['textDocument/codeAction'] = function(_, _, actions)
if actions == nil or vim.tbl_isempty(actions) then
diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua
index b785d2f586..b2d3d0641c 100644
--- a/runtime/lua/vim/lsp/protocol.lua
+++ b/runtime/lua/vim/lsp/protocol.lua
@@ -730,7 +730,15 @@ function protocol.make_client_capabilities()
experimental = nil;
window = {
workDoneProgress = true;
- }
+ showMessage = {
+ messageActionItem = {
+ additionalPropertiesSupport = false;
+ };
+ };
+ showDocument = {
+ support = false;
+ };
+ };
}
end