Repository navigation
feat: host file marks in the Files sidebar - #12
Merged
Merged
Conversation
Merged
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.
Adds a small host API so an embedding app can mark files in the Files sidebar. plannotator-tui needs it to show its "viewed" marks in the file list. Today that list is drawn by diffs-rs and a host cannot decorate a row.
API
set_markers. The engine stores the paths in a hash map, keeps one copy of each distinct badge, and recomputes the folder results in one pass over the tree. Only the sidebar is redrawn and the diff does not reflow, so it is cheap to call on every toggle.replace()orclose(), even for an empty set, so a host can callset_file_marks(&[])at open and the first badge does not shift the rows.git log -p). Marks for paths that are not in the review draw nothing.close().diffsviewer, render exactly as before. The existing sidebar layout tests are unchanged.BadgeColornames theme colors rather than taking aStyle, so badges follow the dark/light theme.Example host
embedded_viewergets avkey: it marks the cursor's file viewed (a green✓and a dimmed row), or unmarks it. A new opt-in check,embedded_host_marks_viewed_files_in_the_sidebar, runs it in a PTY. It checks the ticks, the folder aggregate, the dimmed color, unmarking, and that reopening drops the column.Version
This change only adds API. It adds no field to an existing public struct and no variant to an existing enum. Under the crate's pre-1.0 rule (breaking changes take a minor bump, as in 0.2.0), the next release can be 0.2.1. The CHANGELOG entry is under "0.2.1 - Unreleased".
Cargo.tomlis not bumped; that happens in the release steps.Checks run locally
cargo fmt --checkcargo clippy --locked --all-targets -- -D warnings, and the same with--all-featurescargo test --release --locked --no-fail-fast -- --test-threads=1NATIVE_DIFF_HOST_BINARY(7 passed)cargo +1.88.0 check --locked --all-targetsRUSTDOCFLAGS="-D warnings" cargo doc --no-depsI also wired the API into a local plannotator-tui branch and ran the real binary to confirm the API fits that host. That branch is not pushed; it will wait for a release.