diff options
author | Jeremy Fleischman <jeremyfleischman@gmail.com> | 2024-12-11 17:32:07 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-11 17:32:07 -0800 |
commit | 5eda7aafe995bfefd46fe859f32fa8581ab7f15d (patch) | |
tree | 4ae90f51780f8088872d5ca2052b9f453e0c6d64 /runtime/lua/vim/diagnostic.lua | |
parent | 21961967ffef6d49512b83a23b6c93bb8b80389a (diff) | |
download | rneovim-5eda7aafe995bfefd46fe859f32fa8581ab7f15d.tar.gz rneovim-5eda7aafe995bfefd46fe859f32fa8581ab7f15d.tar.bz2 rneovim-5eda7aafe995bfefd46fe859f32fa8581ab7f15d.zip |
fix(diagnostic): setqflist() is stuck after vim.lsp.buf.document_symbol #31553
Previously, when updating the quickfix diagnostics list, we'd update it,
and then open the quickfix buffer, but there was no guarantee that the
quickfix buffer would be displaying the quickfix diagnostics list (it
could very possibly be displaying some other quickfix list!).
This fixes things so we first select the quickfix list before opening the
quickfix buffer. If `open` is not specified, the behavior is the same as
before: we update the diagnostics quickfix list, but do not navigate to
it.
fixes https://github.com/neovim/neovim/issues/31540
Diffstat (limited to 'runtime/lua/vim/diagnostic.lua')
-rw-r--r-- | runtime/lua/vim/diagnostic.lua | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua index 1b61cf8f71..62997924d9 100644 --- a/runtime/lua/vim/diagnostic.lua +++ b/runtime/lua/vim/diagnostic.lua @@ -869,7 +869,16 @@ local function set_list(loclist, opts) }) end if open then - api.nvim_command(loclist and 'lwindow' or 'botright cwindow') + if loclist then + api.nvim_command('lwindow') + else + -- First navigate to the diagnostics quickfix list. + local nr = vim.fn.getqflist({ id = _qf_id, nr = 0 }).nr + api.nvim_command(nr .. 'chistory') + + -- Now open the quickfix list. + api.nvim_command('botright cwindow') + end end end |