refactor(lsp): remove deprecated code (#22389)

This commit is contained in:
Raphael 2023-02-24 19:55:50 +08:00 committed by GitHub
parent 04a6369da5
commit 1803dadb20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1294,26 +1294,6 @@ function lsp.start_client(config)
client.server_capabilities =
assert(result.capabilities, "initialize result doesn't contain capabilities")
client.server_capabilities = protocol.resolve_capabilities(client.server_capabilities)
-- Deprecation wrapper: this will be removed in 0.8
local mt = {}
mt.__index = function(table, key)
if key == 'resolved_capabilities' then
vim.notify_once(
'[LSP] Accessing client.resolved_capabilities is deprecated, '
.. 'update your plugins or configuration to access client.server_capabilities instead.'
.. 'The new key/value pairs in server_capabilities directly match those '
.. 'defined in the language server protocol',
vim.log.levels.WARN
)
rawset(table, key, protocol._resolve_capabilities_compat(client.server_capabilities))
return rawget(table, key)
else
return rawget(table, key)
end
end
setmetatable(client, mt)
client.supports_method = function(method)
local required_capability = lsp._request_name_to_capability[method]
-- if we don't know about the method, assume that the client supports it.