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:
Jaehwang Jerry Jung
2021-06-15 15:07:52 +09:00
committed by GitHub
parent 44fad0a7a3
commit b8dfa2f112

View File

@@ -321,9 +321,9 @@ function M.save(diagnostics, bufnr, client_id)
-- Clean up our data when the buffer unloads.
api.nvim_buf_attach(bufnr, false, {
on_detach = function(b)
on_detach = function(_, b)
clear_diagnostic_cache(b, client_id)
_diagnostic_cleanup[bufnr][client_id] = nil
_diagnostic_cleanup[b][client_id] = nil
end
})
end