neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 4ace9e7e417fe26c8b73ff1d6042e6e4f3df9ebf
parent 849f544d6285c6f49718a74bcaff964aeffe3db4
Author: 李晓辉 <lixiaohui0812@gmail.com>
Date:   Sat, 31 Dec 2022 02:23:54 +0800

feat(diagnostic): don't open quickfix/loclist if no diagnostics #21397


Diffstat:
Mruntime/lua/vim/diagnostic.lua | 6+++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua @@ -478,13 +478,17 @@ local function set_list(loclist, opts) -- numbers beyond the end of the buffer local diagnostics = get_diagnostics(bufnr, opts, false) local items = M.toqflist(diagnostics) + if next(items) == nil then + vim.notify('No diagnostics available') + return + end if loclist then vim.fn.setloclist(winnr, {}, ' ', { title = title, items = items }) else vim.fn.setqflist({}, ' ', { title = title, items = items }) end if open then - api.nvim_command(loclist and 'lopen' or 'botright copen') + api.nvim_command(loclist and 'lwindow' or 'botright cwindow') end end