mirror of
https://github.com/neovim/neovim.git
synced 2025-11-09 12:05:14 +00:00
fix(lsp): fix on_detach in lsp.diagnostic
`lsp.diagnostic.get_all()` was returning diagnotics for `:bwipeout`-ed buffers because the diagnostic cache is not cleared. The first argument of on_detach callback is the string "detach", not the bufnr.
This commit is contained in:
committed by
GitHub
parent
44fad0a7a3
commit
b8dfa2f112
@@ -321,9 +321,9 @@ function M.save(diagnostics, bufnr, client_id)
|
|||||||
|
|
||||||
-- Clean up our data when the buffer unloads.
|
-- Clean up our data when the buffer unloads.
|
||||||
api.nvim_buf_attach(bufnr, false, {
|
api.nvim_buf_attach(bufnr, false, {
|
||||||
on_detach = function(b)
|
on_detach = function(_, b)
|
||||||
clear_diagnostic_cache(b, client_id)
|
clear_diagnostic_cache(b, client_id)
|
||||||
_diagnostic_cleanup[bufnr][client_id] = nil
|
_diagnostic_cleanup[b][client_id] = nil
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user