fix(diagnostic): don't use nil col if missing from qflist (#16357)

If the quickfixlist item doesn't contain a column it is reported as 0.
Rather than using a nil value in such a case (which breaks diagnostics
elsewhere), just keep the 0 value.
This commit is contained in:
Gregory Anders 2021-11-18 12:27:46 -07:00 committed by GitHub
parent a42a9accab
commit 5e46f649e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1545,7 +1545,7 @@ function M.fromqflist(list)
for _, item in ipairs(list) do for _, item in ipairs(list) do
if item.valid == 1 then if item.valid == 1 then
local lnum = math.max(0, item.lnum - 1) local lnum = math.max(0, item.lnum - 1)
local col = item.col > 0 and (item.col - 1) or nil local col = math.max(0, item.col - 1)
local end_lnum = item.end_lnum > 0 and (item.end_lnum - 1) or lnum local end_lnum = item.end_lnum > 0 and (item.end_lnum - 1) or lnum
local end_col = item.end_col > 0 and (item.end_col - 1) or col local end_col = item.end_col > 0 and (item.end_col - 1) or col
local severity = item.type ~= "" and M.severity[item.type] or M.severity.ERROR local severity = item.type ~= "" and M.severity[item.type] or M.severity.ERROR