aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/api.txt2
-rw-r--r--runtime/doc/change.txt10
-rw-r--r--runtime/doc/lsp.txt4
-rw-r--r--runtime/filetype.vim3
-rw-r--r--runtime/lua/vim/lsp/diagnostic.lua4
-rw-r--r--runtime/lua/vim/lsp/handlers.lua39
-rw-r--r--runtime/lua/vim/lsp/protocol.lua10
7 files changed, 61 insertions, 11 deletions
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt
index 7a3af78ab4..c4b4594290 100644
--- a/runtime/doc/api.txt
+++ b/runtime/doc/api.txt
@@ -376,7 +376,7 @@ on writing and loading a buffer to file, nor in undo/redo cycles.
Highlights are registered using the |nvim_buf_add_highlight()| function. If an
external highlighter plugin wants to add many highlights in a batch,
performance can be improved by calling |nvim_buf_add_highlight()| as an
-asynchronous notification, after first (synchronously) reqesting a source id.
+asynchronous notification, after first (synchronously) requesting a source id.
Example using the Python API client (|pynvim|):
>
diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt
index 5c67359002..f3ed086933 100644
--- a/runtime/doc/change.txt
+++ b/runtime/doc/change.txt
@@ -954,9 +954,13 @@ inside of strings can change! Also see 'softtabstop' option. >
delete and yank) ({.%#:} only work with put).
*:reg* *:registers*
-:reg[isters] Display the contents of all numbered and named
- registers. If a register is written to for |:redir|
- it will not be listed.
+:reg[isters] Display the type and contents of all numbered and
+ named registers. If a register is written to for
+ |:redir| it will not be listed.
+ Type can be one of:
+ "c" for |characterwise| text
+ "l" for |linewise| text
+ "b" for |blockwise-visual| text
:reg[isters] {arg} Display the contents of the numbered and named
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/filetype.vim b/runtime/filetype.vim
index ed3204c537..d2083b23d3 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -623,6 +623,9 @@ au BufNewFile,BufRead *.mo,*.gdmo setf gdmo
" Gedcom
au BufNewFile,BufRead *.ged,lltxxxxx.txt setf gedcom
+" Gift (Moodle)
+autocmd BufRead,BufNewFile *.gift setf gift
+
" Git
au BufNewFile,BufRead COMMIT_EDITMSG,MERGE_MSG,TAG_EDITMSG setf gitcommit
au BufNewFile,BufRead *.git/config,.gitconfig,/etc/gitconfig setf gitconfig
diff --git a/runtime/lua/vim/lsp/diagnostic.lua b/runtime/lua/vim/lsp/diagnostic.lua
index c98fde3696..072349b226 100644
--- a/runtime/lua/vim/lsp/diagnostic.lua
+++ b/runtime/lua/vim/lsp/diagnostic.lua
@@ -1044,6 +1044,8 @@ function M.display(diagnostics, bufnr, client_id, config)
diagnostics = diagnostics or M.get(bufnr, client_id)
+ vim.api.nvim_command("doautocmd <nomodeline> User LspDiagnosticsChanged")
+
if not diagnostics or vim.tbl_isempty(diagnostics) then
return
end
@@ -1062,8 +1064,6 @@ function M.display(diagnostics, bufnr, client_id, config)
if signs_opts then
M.set_signs(diagnostics, bufnr, client_id, nil, signs_opts)
end
-
- vim.api.nvim_command("doautocmd <nomodeline> User LspDiagnosticsChanged")
end
-- }}}
-- Diagnostic User Functions {{{
diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua
index a3bf61ba0b..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
@@ -253,9 +289,8 @@ M['textDocument/signatureHelp'] = function(_, method, result)
end
--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_documentHighlight
-M['textDocument/documentHighlight'] = function(_, _, result, _)
+M['textDocument/documentHighlight'] = function(_, _, result, _, bufnr, _)
if not result then return end
- local bufnr = api.nvim_get_current_buf()
util.buf_highlight_references(bufnr, result)
end
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