diff options
author | Michael Lingelbach <m.j.lbach@gmail.com> | 2021-06-05 14:46:10 -0700 |
---|---|---|
committer | Michael Lingelbach <m.j.lbach@gmail.com> | 2021-06-05 14:46:10 -0700 |
commit | 15abde1676575cd4b938087b4fe7bed5d7182951 (patch) | |
tree | 5173142064638859c8c81d3062c0c6edaf7cd618 /runtime/lua/vim/lsp/diagnostic.lua | |
parent | becbb7436f7f027f0ff1fcf440334c0b3a9a8e1a (diff) | |
download | rneovim-15abde1676575cd4b938087b4fe7bed5d7182951.tar.gz rneovim-15abde1676575cd4b938087b4fe7bed5d7182951.tar.bz2 rneovim-15abde1676575cd4b938087b4fe7bed5d7182951.zip |
fix(lsp): set_loclist should target current win
Currently, for large number of diagnostics, the delay in populating
loclist may be sufficient for a user to switch to another window,
resulting in the loclist being populated on the wrong window.
Diffstat (limited to 'runtime/lua/vim/lsp/diagnostic.lua')
-rw-r--r-- | runtime/lua/vim/lsp/diagnostic.lua | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/runtime/lua/vim/lsp/diagnostic.lua b/runtime/lua/vim/lsp/diagnostic.lua index 6a7dc1bbb0..03d7121caa 100644 --- a/runtime/lua/vim/lsp/diagnostic.lua +++ b/runtime/lua/vim/lsp/diagnostic.lua @@ -1202,6 +1202,8 @@ function M.set_loclist(opts) local open_loclist = if_nil(opts.open_loclist, true) + local win_id = vim.api.nvim_get_current_win() + local bufnr = vim.api.nvim_get_current_buf() local buffer_diags = M.get(bufnr, opts.client_id) @@ -1234,7 +1236,7 @@ function M.set_loclist(opts) table.sort(items, function(a, b) return a.lnum < b.lnum end) - util.set_loclist(items) + util.set_loclist(items, win_id) if open_loclist then vim.cmd [[lopen]] end |