aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/handlers.lua
diff options
context:
space:
mode:
authorMichael Lingelbach <m.j.lbach@gmail.com>2020-12-30 16:05:30 -0800
committerMichael Lingelbach <m.j.lbach@gmail.com>2021-01-01 01:40:33 -0800
commite467d29390495ac05dd99942339640bfaacd4108 (patch)
tree4e0d1a917dc60d1ffe3bae6d81d794f32c759d52 /runtime/lua/vim/lsp/handlers.lua
parent874208266142c0a93d2076525256b813ff9b74e0 (diff)
downloadrneovim-e467d29390495ac05dd99942339640bfaacd4108.tar.gz
rneovim-e467d29390495ac05dd99942339640bfaacd4108.tar.bz2
rneovim-e467d29390495ac05dd99942339640bfaacd4108.zip
LSP: Move workspace/configuration handler from nvim-lspconfig to core
Diffstat (limited to 'runtime/lua/vim/lsp/handlers.lua')
-rw-r--r--runtime/lua/vim/lsp/handlers.lua25
1 files changed, 25 insertions, 0 deletions
diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua
index fd23a6a547..abe0fa2939 100644
--- a/runtime/lua/vim/lsp/handlers.lua
+++ b/runtime/lua/vim/lsp/handlers.lua
@@ -149,6 +149,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