diff options
author | Matthieu Coudron <teto@users.noreply.github.com> | 2021-01-01 23:52:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-01 23:52:48 +0100 |
commit | 48caf1df8581a9a9da9072f901411b918333952d (patch) | |
tree | c1dfa6befd03c69c8d70fcc67996905ce6faf091 /runtime/lua/vim/lsp/handlers.lua | |
parent | 4a0a6f7bff64b03c80dd84444fc4dbddbe1065ad (diff) | |
parent | f3bbc92476df1112deb34b9c7408cd594ee47a50 (diff) | |
download | rneovim-48caf1df8581a9a9da9072f901411b918333952d.tar.gz rneovim-48caf1df8581a9a9da9072f901411b918333952d.tar.bz2 rneovim-48caf1df8581a9a9da9072f901411b918333952d.zip |
Merge pull request #13649 from mjlbach/move_from_nvim-lspconfig
LSP: Move workspace/configuration from nvim-lspconfig to core
Diffstat (limited to 'runtime/lua/vim/lsp/handlers.lua')
-rw-r--r-- | runtime/lua/vim/lsp/handlers.lua | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua index c26affc100..de00d36188 100644 --- a/runtime/lua/vim/lsp/handlers.lua +++ b/runtime/lua/vim/lsp/handlers.lua @@ -148,6 +148,31 @@ M['workspace/applyEdit'] = function(_, _, workspace_edit) } end +--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_configuration +M['workspace/configuration'] = function(err, _, params, client_id) + local client = vim.lsp.get_client_by_id(client_id) + if not client then + err_message("LSP[id=", client_id, "] client has shut down after sending the message") + end + if err then error(vim.inspect(err)) end + if not params.items then + return {} + end + + local result = {} + for _, item in ipairs(params.items) do + if item.section then + local value = util.lookup_section(client.config.settings, item.section) or vim.NIL + -- For empty sections with no explicit '' key, return settings as is + if value == vim.NIL and item.section == '' then + value = client.config.settings or vim.NIL + end + table.insert(result, value) + end + end + return result +end + M['textDocument/publishDiagnostics'] = function(...) return require('vim.lsp.diagnostic').on_publish_diagnostics(...) end |