mirror of
https://github.com/neovim/neovim.git
synced 2025-10-22 17:11:49 +00:00
Merge pull request #14730 from mjlbach/feature/open_loclist_on_win
fix(lsp): set_loclist should target current win
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)
|
||||
|
||||
@@ -1232,7 +1234,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
|
||||
|
@@ -1602,8 +1602,8 @@ end
|
||||
--- Can be obtained with e.g. |vim.lsp.util.locations_to_items()|.
|
||||
---
|
||||
--@param items (table) list of items
|
||||
function M.set_loclist(items)
|
||||
vim.fn.setloclist(0, {}, ' ', {
|
||||
function M.set_loclist(items, win_id)
|
||||
vim.fn.setloclist(win_id or 0, {}, ' ', {
|
||||
title = 'Language Server';
|
||||
items = items;
|
||||
})
|
||||
|
Reference in New Issue
Block a user