aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim
diff options
context:
space:
mode:
authorMichael Lingelbach <m.j.lbach@gmail.com>2021-06-05 17:12:55 -0700
committerGitHub <noreply@github.com>2021-06-05 17:12:55 -0700
commit36802b895f6c426c37e84a0ade3f64bfcf2eb842 (patch)
tree156bace1f4962dc0a10049a0df7abc86a33ef67d /runtime/lua/vim
parentf214c19e2b463c88b3c8320346fcb0b050617fb1 (diff)
parent15abde1676575cd4b938087b4fe7bed5d7182951 (diff)
downloadrneovim-36802b895f6c426c37e84a0ade3f64bfcf2eb842.tar.gz
rneovim-36802b895f6c426c37e84a0ade3f64bfcf2eb842.tar.bz2
rneovim-36802b895f6c426c37e84a0ade3f64bfcf2eb842.zip
Merge pull request #14730 from mjlbach/feature/open_loclist_on_win
fix(lsp): set_loclist should target current win
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r--runtime/lua/vim/lsp/diagnostic.lua4
-rw-r--r--runtime/lua/vim/lsp/util.lua4
2 files changed, 5 insertions, 3 deletions
diff --git a/runtime/lua/vim/lsp/diagnostic.lua b/runtime/lua/vim/lsp/diagnostic.lua
index ebd5773d6e..66a7e39749 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)
@@ -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
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua
index 5a0bcd258e..9862b1dd32 100644
--- a/runtime/lua/vim/lsp/util.lua
+++ b/runtime/lua/vim/lsp/util.lua
@@ -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;
})