mirror of
https://github.com/neovim/neovim.git
synced 2025-11-22 10:06:33 +00:00
fix(lsp): trigger LspDetach on buffer delete
Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
(cherry picked from commit 5ac8db10f0)
Co-authored-by: Andre Toerien <49614525+AThePeanut4@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
3a727beafd
commit
10a16c1311
@@ -572,10 +572,19 @@ local function buf_attach(bufnr)
|
||||
on_detach = function()
|
||||
local params = { textDocument = { uri = uri } }
|
||||
for _, client in ipairs(lsp.get_clients({ bufnr = bufnr })) do
|
||||
api.nvim_exec_autocmds('LspDetach', {
|
||||
buffer = bufnr,
|
||||
modeline = false,
|
||||
data = { client_id = client.id },
|
||||
})
|
||||
|
||||
changetracking.reset_buf(client, bufnr)
|
||||
if vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'openClose') then
|
||||
client.notify(ms.textDocument_didClose, params)
|
||||
end
|
||||
|
||||
local namespace = lsp.diagnostic.get_namespace(client.id)
|
||||
vim.diagnostic.reset(namespace, bufnr)
|
||||
end
|
||||
for _, client in ipairs(all_clients) do
|
||||
client.attached_buffers[bufnr] = nil
|
||||
|
||||
Reference in New Issue
Block a user