refactor(diff): clarify path parameter names in show_diff (#55)#89
Open
AzarAI-TOP wants to merge 1 commit into
Open
refactor(diff): clarify path parameter names in show_diff (#55)#89AzarAI-TOP wants to merge 1 commit into
AzarAI-TOP wants to merge 1 commit into
Conversation
The path-like parameters threaded through diff.lua had drifted from what they actually hold, making them easy to misuse. Rename them to match the vocabulary in Cannon07#55: - real_file_path -> display_path (winbar display string, often cwd-relative) - abs_file_path -> file_path (canonical identity; active_diffs key) - original_path -> original_source_path (temp file holding the before content) - proposed_path -> proposed_source_path (temp file holding the after content) Pure rename, no behaviour change. Updates the four affected functions (show_diff, show_inline_diff, build_inline_diff, mark_change_and_reveal) and two now-stale comments in diff_lifecycle_spec.lua. The show_diff call sites in pre_tool/init.lua already pass display_path/file_path positionally, so they need no change. bin/core-pre-tool.sh referenced in the issue no longer exists on main. All plugin specs pass (./tests/run_lua.sh): 9 files, 0 failures, 0 errors. Closes Cannon07#55 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #55.
What
Renames the path-like parameters threaded through
lua/code-preview/diff.luaso their names match what they actually hold:real_file_pathdisplay_pathabs_file_pathfile_pathactive_diffskey, passed to the changes registry / neo-tree revealoriginal_pathoriginal_source_pathproposed_pathproposed_source_pathSo the signature becomes:
Scope
Pure rename, no behaviour change. Touches the four functions that thread these args:
mark_change_and_reveal,build_inline_diff,show_inline_diff, andM.show_diff— plus two now-stale comments intests/plugin/diff_lifecycle_spec.lua.A couple of notes vs. the issue description, since the code has moved since it was filed:
show_diffcall sites now live inlua/code-preview/pre_tool/init.luaand already passdisplay_path(...)/file_pathpositionally, so they need no change.bin/core-pre-tool.shreferenced in the issue no longer exists onmain; there are no remaining references to the old names anywhere in the repo (grepclean).Acceptance criteria
real_file_pathandabs_file_pathremoved in favour ofdisplay_pathandfile_pathoriginal_path/proposed_path(temp content files) renamed to*_source_pathTesting
./tests/run_lua.sh— all plugin specs pass: 9 files, 0 failures, 0 errors (incl.diff_lifecycle_spec.lua, 18/18). Neovim v0.12.