diff options
author | Gregory Anders <8965202+gpanders@users.noreply.github.com> | 2021-10-02 21:01:40 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-02 21:01:40 -0600 |
commit | 23d13aa4cce594b30fc353ee251dd5bab1b113c3 (patch) | |
tree | 383b1a9fcb756e3c45dc26442d95f63825da33f7 /runtime/lua/vim/diagnostic.lua | |
parent | 0c06da1f0a0ebe45c92d2c1d63121c6ead604fe5 (diff) | |
parent | 0f554ef6f864a723736b061ee740daf419ff94e1 (diff) | |
download | rneovim-23d13aa4cce594b30fc353ee251dd5bab1b113c3.tar.gz rneovim-23d13aa4cce594b30fc353ee251dd5bab1b113c3.tar.bz2 rneovim-23d13aa4cce594b30fc353ee251dd5bab1b113c3.zip |
Merge pull request #15786 from gpanders/diagnostic-signs-unique-severity
Diffstat (limited to 'runtime/lua/vim/diagnostic.lua')
-rw-r--r-- | runtime/lua/vim/diagnostic.lua | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua index 35badf8a02..c7c8c1878e 100644 --- a/runtime/lua/vim/diagnostic.lua +++ b/runtime/lua/vim/diagnostic.lua @@ -620,23 +620,22 @@ function M.set(namespace, bufnr, diagnostics, opts) } if vim.tbl_isempty(diagnostics) then - return M.reset(namespace, bufnr) - end - - if not diagnostic_cleanup[bufnr][namespace] then - diagnostic_cleanup[bufnr][namespace] = true - - -- Clean up our data when the buffer unloads. - vim.api.nvim_buf_attach(bufnr, false, { - on_detach = function(_, b) - clear_diagnostic_cache(b, namespace) - diagnostic_cleanup[b][namespace] = nil - end - }) + clear_diagnostic_cache(namespace, bufnr) + else + if not diagnostic_cleanup[bufnr][namespace] then + diagnostic_cleanup[bufnr][namespace] = true + + -- Clean up our data when the buffer unloads. + vim.api.nvim_buf_attach(bufnr, false, { + on_detach = function(_, b) + clear_diagnostic_cache(b, namespace) + diagnostic_cleanup[b][namespace] = nil + end + }) + end + set_diagnostic_cache(namespace, bufnr, diagnostics) end - set_diagnostic_cache(namespace, bufnr, diagnostics) - if vim.api.nvim_buf_is_loaded(bufnr) then M.show(namespace, bufnr, diagnostics, opts) elseif opts then |