feat(highlight): warn when hunks exceed max_lines

Problem: when a hunk's highlighted lines exceed `max_lines`, syntax
highlighting is silently skipped. Users have no indication why parts
of their diff lack highlighting.

Solution: add `highlights.warn_max_lines` (default `true`) that emits
a `vim.notify` warning with the hunk index and line count vs threshold.
Also change `max_lines` to count only highlighted (`+`/`-`) lines
rather than total body lines including context.
This commit is contained in:
Barrett Ruth 2026-03-10 16:36:50 -04:00
parent c7cd8fc24c
commit 5199e72bd0
4 changed files with 74 additions and 22 deletions

View file

@ -135,8 +135,8 @@ describe('highlight', function()
local lines = { '@@ -1,100 +1,101 @@' }
local hunk_lines = {}
for i = 1, 600 do
table.insert(lines, ' line ' .. i)
table.insert(hunk_lines, ' line ' .. i)
table.insert(lines, '+line ' .. i)
table.insert(hunk_lines, '+line ' .. i)
end
local bufnr = create_buffer(lines)