diffs.nvim/lua/diffs
Barrett Ruth e7d56e3bbe
Some checks are pending
luarocks / quality (push) Waiting to run
luarocks / publish (push) Blocked by required conditions
feat(highlight): wire highlights.context into treesitter pipeline (#151)
## Problem

`highlights.context.enabled` and `highlights.context.lines` were
defined, validated, and range-checked but never read during
highlighting. Hunks inside incomplete constructs (e.g., a table literal
or function body whose opening is beyond the hunk's own context lines)
parsed incorrectly because treesitter had no surrounding code.

## Solution

`compute_hunk_context` in `init.lua` reads the working tree file using
the hunk's `@@ +start,count @@` line numbers to collect up to `lines`
(default 25) surrounding code lines in each direction. Files are read
once via `io.open` and cached across hunks in the same file.
`highlight_treesitter` in `highlight.lua` accepts an optional context
parameter that prepends/appends context lines to the parse string and
offsets capture rows by the prefix count, so extmarks only land on
actual hunk lines. Wired through `highlight_hunk` for the two
code-language treesitter calls (not headers, not `highlight_text`, not
vim syntax).

Closes #148.
2026-03-05 11:14:31 -05:00
..
commands.lua feat: unified diff conflict resolution for unmerged files (#99) 2026-02-09 12:21:13 -05:00
conflict.lua fix: pre-release cleanup for v0.2.0 (#102) 2026-02-09 15:08:36 -05:00
debug.lua fix(debug): resolve sparse array crash in json dump 2026-02-07 00:50:02 -05:00
diff.lua fix(diff): strip linematch from char-level diff 2026-02-07 00:50:08 -05:00
fugitive.lua fix: pre-release cleanup for v0.2.0 (#102) 2026-02-09 15:08:36 -05:00
git.lua perf: cache repo root and harden async paths (#100) 2026-02-09 12:39:13 -05:00
health.lua feat(highlight): add character-level intra-line diff highlighting 2026-02-06 13:53:58 -05:00
highlight.lua feat(highlight): wire highlights.context into treesitter pipeline (#151) 2026-03-05 11:14:31 -05:00
init.lua feat(highlight): wire highlights.context into treesitter pipeline (#151) 2026-03-05 11:14:31 -05:00
lib.lua perf: cache repo root and harden async paths (#100) 2026-02-09 12:39:13 -05:00
log.lua performance improvements (#116) 2026-02-12 16:59:13 -05:00
merge.lua fix: pre-release cleanup for v0.2.0 (#102) 2026-02-09 15:08:36 -05:00
parser.lua feat(highlight): wire highlights.context into treesitter pipeline (#151) 2026-03-05 11:14:31 -05:00