mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
refactor(lsp): no longer rely on LspDetach
for detaching capabilities
This commit is contained in:
@@ -60,17 +60,6 @@ function M:new(bufnr)
|
||||
})
|
||||
self.client_state = {}
|
||||
|
||||
api.nvim_create_autocmd('LspDetach', {
|
||||
group = self.augroup,
|
||||
buffer = bufnr,
|
||||
callback = function(args)
|
||||
self:on_detach(args.data.client_id)
|
||||
if next(self.client_state) == nil then
|
||||
self:destroy()
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
Class.active[bufnr] = self
|
||||
return self
|
||||
end
|
||||
|
@@ -1209,6 +1209,24 @@ function Client:_on_detach(bufnr)
|
||||
})
|
||||
end
|
||||
|
||||
for _, Capability in pairs(vim.lsp._capability.all) do
|
||||
if
|
||||
self:supports_method(Capability.method)
|
||||
and vim.lsp._capability.is_enabled(Capability.name, {
|
||||
bufnr = bufnr,
|
||||
client_id = self.id,
|
||||
})
|
||||
then
|
||||
local capability = Capability.active[bufnr]
|
||||
if capability then
|
||||
capability:on_detach(self.id)
|
||||
if next(capability.client_state) == nil then
|
||||
capability:destroy()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
changetracking.reset_buf(self, bufnr)
|
||||
|
||||
if self:supports_method(ms.textDocument_didClose) then
|
||||
|
Reference in New Issue
Block a user