Skip to content

Commit

Permalink
fix(on_result_diagnostic): treat end_lnum < 1 as unitialized
Browse files Browse the repository at this point in the history
The end of the diagnostic range was previously calculated as `item.end_lnum and item.end_lnum - 1`. Given `item = { lnum: 95, end_lnum: 0, ... }`, this calculation would span everything from the beginning up to line 95. I believe that an `end_lnum` value of zero should be treated as uninitialized (because lines are 1-indexed). Therefore, I think the item should be considered a single-line item.
  • Loading branch information
ruslanSorokin committed Jan 10, 2025
1 parent 2a2b6fe commit b6d5352
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lua/overseer/component/on_result_diagnostics.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ local comp = {
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),
end_lnum = (item.end_lnum and item.end_lnum > 0) and (item.end_lnum - 1) or item.lnum,
col = item.col or 0,
end_col = item.end_col,
source = task.name,
Expand Down

0 comments on commit b6d5352

Please sign in to comment.