mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user