From b6d5352f23a44a6377cb232bb7c35961226f2d05 Mon Sep 17 00:00:00 2001 From: Ruslan Sorokin Date: Fri, 10 Jan 2025 11:59:08 +0300 Subject: [PATCH] fix(on_result_diagnostic): treat `end_lnum < 1` as unitialized 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. --- lua/overseer/component/on_result_diagnostics.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/overseer/component/on_result_diagnostics.lua b/lua/overseer/component/on_result_diagnostics.lua index e084aa34..f7003c84 100644 --- a/lua/overseer/component/on_result_diagnostics.lua +++ b/lua/overseer/component/on_result_diagnostics.lua @@ -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,