aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/diagnostic.lua
diff options
context:
space:
mode:
authorGregory Anders <greg@gpanders.com>2021-11-24 19:57:27 -0700
committerGregory Anders <greg@gpanders.com>2021-11-24 20:03:48 -0700
commit0341c687a35381b360f5f2a89f444490b09c5cda (patch)
tree431a2034b56831a585bbc9cc75bf3cbc3db963b4 /runtime/lua/vim/diagnostic.lua
parent25ab7c6c0af2dd7ba2bb70fa6081b2ca5cfb8774 (diff)
downloadrneovim-0341c687a35381b360f5f2a89f444490b09c5cda.tar.gz
rneovim-0341c687a35381b360f5f2a89f444490b09c5cda.tar.bz2
rneovim-0341c687a35381b360f5f2a89f444490b09c5cda.zip
fix(diagnostic): don't clamp line numbers in setqflist
Reverts 5b0d8f85fdb705b07143fc4019189a9dcfe3c108. Diagnostic producers can send diagnostics for buffers that are not loaded, for which we cannot retrieve the line count to clamp line numbers. This means that some diagnostics in the quickfix list could be line-clamped and others not. The quickfix list can already handle line numbers past the end of the buffer (i.e. it *already* clamps line numbers) so just use the "raw" diagnostic positions sent from the producer.
Diffstat (limited to 'runtime/lua/vim/diagnostic.lua')
-rw-r--r--runtime/lua/vim/diagnostic.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua
index 85b430375e..16ff14a2e7 100644
--- a/runtime/lua/vim/diagnostic.lua
+++ b/runtime/lua/vim/diagnostic.lua
@@ -441,7 +441,9 @@ local function set_list(loclist, opts)
if loclist then
bufnr = vim.api.nvim_win_get_buf(winnr)
end
- local diagnostics = get_diagnostics(bufnr, opts, true)
+ -- Don't clamp line numbers since the quickfix list can already handle line
+ -- numbers beyond the end of the buffer
+ local diagnostics = get_diagnostics(bufnr, opts, false)
local items = M.toqflist(diagnostics)
if loclist then
vim.fn.setloclist(winnr, {}, ' ', { title = title, items = items })