You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This mixing makes the file hard to extend and impossible to test in pieces. Per ADR-0003, the inline renderer is the strategic direction, so the seam between renderers is also a natural extension point.
Proposed direction
Extract along these lines (final names up for discussion):
lua/code-preview/diff/init.lua — public entry (show_diff, close_for_file, etc.). Owns the active-previews registry.
Motivation
lua/code-preview/diff.luais 599 lines covering four loosely related concerns:show_diffafter thelayout == "inline"branch).show_inline_diff,build_inline_diff,char_diff_ranges,inline_statuscolumn,apply_inline_highlights).active_diffs,is_open,close_for_file,close_diff_and_clear,_active_diffs).mark_change_and_reveal) — already tracked separately.This mixing makes the file hard to extend and impossible to test in pieces. Per ADR-0003, the inline renderer is the strategic direction, so the seam between renderers is also a natural extension point.
Proposed direction
Extract along these lines (final names up for discussion):
lua/code-preview/diff/init.lua— public entry (show_diff,close_for_file, etc.). Owns the active-previews registry.lua/code-preview/diff/inline.lua— inline renderer (build, highlight, statuscolumn, keymaps).lua/code-preview/diff/side_by_side.lua—:diffthis-based renderer.lua/code-preview/diff/util.lua— shared helpers (read_file_lines,char_diff_rangesif both renderers end up using it after Port character-level diff highlights to the side-by-side renderer #56).Renderers expose
render(...) → {tab, bufs, augroup, inline_win?}; the registry doesn't care which one ran.Scope
require('code-preview.diff').show_diffetc. continue to work).tests/plugin/diff_lifecycle_spec.lua) must pass unchanged.Out of scope
mark_change_and_revealfrom diff.lua — tracked separately.Dependencies / ordering
Sequence with the rest of the refactor backlog: