aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorHirokazu Hata <h.hata.ai.t@gmail.com>2020-11-16 09:58:42 +0900
committerGitHub <noreply@github.com>2020-11-16 09:58:42 +0900
commit35b006423fb9f758ddbd90d83389470291b6dad0 (patch)
tree08fecb01d979e27d769cb2dc8de68e70fb9352d9 /lua
parent[docgen] Update README.md (diff)
parentRe-add negation after automated commit (diff)
downloadnvim-lspconfig-35b006423fb9f758ddbd90d83389470291b6dad0.tar
nvim-lspconfig-35b006423fb9f758ddbd90d83389470291b6dad0.tar.gz
nvim-lspconfig-35b006423fb9f758ddbd90d83389470291b6dad0.tar.bz2
nvim-lspconfig-35b006423fb9f758ddbd90d83389470291b6dad0.tar.lz
nvim-lspconfig-35b006423fb9f758ddbd90d83389470291b6dad0.tar.xz
nvim-lspconfig-35b006423fb9f758ddbd90d83389470291b6dad0.tar.zst
nvim-lspconfig-35b006423fb9f758ddbd90d83389470291b6dad0.zip
Merge pull request #399 from Iron-E/patch-1
Diffstat (limited to 'lua')
-rw-r--r--lua/lspconfig/configs.lua21
-rw-r--r--lua/lspconfig/jdtls.lua6
-rw-r--r--lua/lspconfig/util.lua2
3 files changed, 14 insertions, 15 deletions
diff --git a/lua/lspconfig/configs.lua b/lua/lspconfig/configs.lua
index 16ef9949..1a844c85 100644
--- a/lua/lspconfig/configs.lua
+++ b/lua/lspconfig/configs.lua
@@ -33,26 +33,25 @@ function configs.__newindex(t, config_name, config_def)
-- The config here is the one which will be instantiated for the new server,
-- which is why this is a function, so that it can refer to the settings
-- object on the server.
- local function add_callbacks(config)
- config.callbacks["window/logMessage"] = function(err, method, params, client_id)
+ local function add_handlers(config)
+ assert(not config.callbacks, "lsp.callbacks has been obsoleted. See here for more: https://github.com/neovim/neovim/pull/12655")
+ config.handlers["window/logMessage"] = function(err, method, params, client_id)
if params and params.type <= config.log_level then
-- TODO(ashkan) remove this after things have settled.
- assert(lsp.callbacks, "Update to Nvim HEAD. This is an incompatible interface.")
- assert(lsp.callbacks["window/logMessage"], "Callback for window/logMessage notification is not defined")
- lsp.callbacks["window/logMessage"](err, method, params, client_id)
+ assert(lsp.handlers["window/logMessage"], "Handler for window/logMessage notification is not defined")
+ lsp.handlers["window/logMessage"](err, method, params, client_id)
end
end
- config.callbacks["window/showMessage"] = function(err, method, params, client_id)
+ config.handlers["window/showMessage"] = function(err, method, params, client_id)
if params and params.type <= config.message_level then
-- TODO(ashkan) remove this after things have settled.
- assert(lsp.callbacks and lsp.callbacks[method], "Update to Nvim HEAD. This is an incompatible interface.")
- assert(lsp.callbacks["window/showMessage"], "Callback for window/showMessage notification is not defined")
- lsp.callbacks["window/showMessage"](err, method, params, client_id)
+ assert(lsp.handlers["window/showMessage"], "Handler for window/showMessage notification is not defined")
+ lsp.handlers["window/showMessage"](err, method, params, client_id)
end
end
- config.callbacks["workspace/configuration"] = function(err, method, params, client_id)
+ config.handlers["workspace/configuration"] = function(err, method, params, client_id)
if err then error(tostring(err)) end
if not params.items then
return {}
@@ -124,7 +123,7 @@ function configs.__newindex(t, config_name, config_def)
}
})
- add_callbacks(new_config)
+ add_handlers(new_config)
if config_def.on_new_config then
pcall(config_def.on_new_config, new_config, _root_dir)
end
diff --git a/lua/lspconfig/jdtls.lua b/lua/lspconfig/jdtls.lua
index be9ba6e8..a71e634f 100644
--- a/lua/lspconfig/jdtls.lua
+++ b/lua/lspconfig/jdtls.lua
@@ -1,6 +1,6 @@
local configs = require 'lspconfig/configs'
local util = require 'lspconfig/util'
-local callbacks = require 'vim.lsp.callbacks'
+local handlers = require 'vim.lsp.handlers'
local path = util.path
local server_name = "jdtls"
@@ -101,7 +101,7 @@ configs[server_name] = {
jvm_args = {};
os_config = nil;
};
- callbacks = {
+ handlers = {
-- Due to an invalid protocol implementation in the jdtls we have to
-- conform these to be spec compliant.
-- https://github.com/eclipse/eclipse.jdt.ls/issues/376
@@ -113,7 +113,7 @@ configs[server_name] = {
end
end
- callbacks['textDocument/codeAction'](a, b, actions)
+ handlers['textDocument/codeAction'](a, b, actions)
end
};
};
diff --git a/lua/lspconfig/util.lua b/lua/lspconfig/util.lua
index 14eee811..0bf591ae 100644
--- a/lua/lspconfig/util.lua
+++ b/lua/lspconfig/util.lua
@@ -12,7 +12,7 @@ M.default_config = {
message_level = lsp.protocol.MessageType.Warning;
settings = vim.empty_dict();
init_options = vim.empty_dict();
- callbacks = {};
+ handlers = {};
}
function M.validate_bufnr(bufnr)