fix(diagnostic): don't clamp line numbers in setqflist

Reverts 5b0d8f85fd.

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.
This commit is contained in:
Gregory Anders 2021-11-24 19:57:27 -07:00
parent 25ab7c6c0a
commit 0341c687a3

View File

@ -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 })