Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(on_result_diagnostic): treat end_lnum < 1 as unitialized #396

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions lua/overseer/component/on_result_diagnostics.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,20 @@ local comp = {
for filename, items in pairs(grouped) do
local diagnostics = {}
for _, item in ipairs(items) do
local lnum_idx = (item.lnum or 1) - 1

local end_lnum_idx
if item.end_lnum and item.end_lnum > 0 then
end_lnum_idx = item.end_lnum - 1
else
end_lnum_idx = lnum_idx + 1
end

table.insert(diagnostics, {
message = item.text,
severity = type_to_severity[item.type] or vim.diagnostic.severity.ERROR,
lnum = (item.lnum or 1) - 1,
end_lnum = item.end_lnum and (item.end_lnum - 1),
lnum = lnum_idx,
end_lnum = end_lnum_idx,
col = item.col or 0,
end_col = item.end_col,
source = task.name,
Expand Down
Loading