feat(explorer): add optional Git line statistics - #491
Conversation
Move lua/codediff/ui/explorer/formatters.lua into
lua/codediff/ui/explorer/formatters/ so the built-in default row
functions and their helpers each live in their own file:
init.lua module entry; re-exports M.{file,folder,group}
common.lua shared prefix() helper (always active)
stats.lua line-stats rendering helpers (active only when
explorer.line_stats.enabled = true)
file.lua default file row
folder.lua default folder row
group.lua default group row
This matches the folder-module style used by the rest of
lua/codediff/ui/explorer/ and makes it visible from the directory
listing which pieces are always used vs. line-stats specific.
The public require path stays codediff.ui.explorer.formatters, so
nodes.lua, tests, README, and doc references are unchanged. Pure code
motion; no behavior change (89 tests pass across the affected specs:
line_stats, line_formatters, explorer_modules, explorer, explorer_staging,
explorer_file_filter, highlights, git_line_stats).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
esmuellert
left a comment
There was a problem hiding this comment.
Reviewed the diff top-to-bottom: well-scoped, opt-in default, non-breaking (base git API untouched, new highlight groups use default = true, formatter contexts remain additive with stats = nil when disabled). Tests are thorough — 8 real-git integration tests + 5 UI tests covering staged/unstaged/rename/deletion/binary/conflicts/pathspec/disabled-parity/error paths.
Pushed one small refactor commit on top: split explorer/formatters.lua into a explorer/formatters/ folder module (init, common, stats, file, folder, group) so the line-stats bits and the always-active row helpers are visible from the directory listing. Pure code motion; public require path preserved; all affected specs still green.
Nice work — thanks for the clean implementation and the great test coverage.
Adds opt-in Git line statistics to the Explorer.
file,folder, andgroupformatter functionsScreenshots
Before
After - disabled by default
After - enabled with default formatters
After - custom file, folder, and group formatters
Supercedes part of #448.
Fixes #181