refactor: centralize hunk highlight option construction #144

Closed
opened 2026-09-21 18:12:30 +00:00 by barrettruth · 0 comments
Owner

Original issue: barrettruth/diffs.nvim#339
Original author: barrettruth
Original date: 2026-05-13T17:33:41Z

Tracked By

Context

This is pre-v0.4.0 cleanup that should land on main before the hard-removal branch. It must preserve current v0.3.x behavior, including fixed default highlights.priorities and deprecation handling for user-provided priority values.

Problem

Runtime hunk highlight option construction is repeated across runtime paths:

  • lua/diffs/runtime/init.lua
  • lua/diffs/runtime/cache.lua
  • runtime.get_highlight_opts() consumers such as gitsigns

That makes the render option shape harder to reason about before the later hard-removal pass.

Scope

Centralize hunk highlight option construction in a runtime/renderer-owned helper while preserving current config behavior.

Do not remove highlights.priorities from config.new() in this PR. That belongs to the blocked v0.4.0 hard-removal branch.

Acceptance Criteria

  • config.new().highlights.priorities still normalizes to the fixed defaults 198/199/200/201
  • current deprecation behavior for user-provided highlights.priorities is unchanged
  • fast highlight opts still disable treesitter and defer vim syntax
  • syntax-only opts still behave the same
  • gitsigns/runtime consumers use the shared hunk option construction path

Suggested Verification

direnv exec . busted spec/config_spec.lua spec/runtime_spec.lua spec/plugin_spec.lua spec/highlight_spec.lua spec/gitsigns_spec.lua
> Original issue: barrettruth/diffs.nvim#339 > Original author: `barrettruth` > Original date: 2026-05-13T17:33:41Z ## Tracked By - #315 ## Context This is pre-v0.4.0 cleanup that should land on `main` before the hard-removal branch. It must preserve current v0.3.x behavior, including fixed default `highlights.priorities` and deprecation handling for user-provided priority values. ## Problem Runtime hunk highlight option construction is repeated across runtime paths: - `lua/diffs/runtime/init.lua` - `lua/diffs/runtime/cache.lua` - `runtime.get_highlight_opts()` consumers such as gitsigns That makes the render option shape harder to reason about before the later hard-removal pass. ## Scope Centralize hunk highlight option construction in a runtime/renderer-owned helper while preserving current config behavior. Do not remove `highlights.priorities` from `config.new()` in this PR. That belongs to the blocked v0.4.0 hard-removal branch. ## Acceptance Criteria - `config.new().highlights.priorities` still normalizes to the fixed defaults `198/199/200/201` - current deprecation behavior for user-provided `highlights.priorities` is unchanged - fast highlight opts still disable treesitter and defer vim syntax - syntax-only opts still behave the same - gitsigns/runtime consumers use the shared hunk option construction path ## Suggested Verification ```sh direnv exec . busted spec/config_spec.lua spec/runtime_spec.lua spec/plugin_spec.lua spec/highlight_spec.lua spec/gitsigns_spec.lua ```
barrettruth 2026-09-21 18:12:30 +00:00
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
barrettruth/diffs.nvim#144
No description provided.