Repository navigation
feat(tui): move the editor context label to the sidebar - #110
Merged
Merged
Conversation
The prompt footer's right-side group is crowded, and the open editor file plus its selected range sit closer in kind to the sidebar's ambient session state than to the footer's keybind hints. Render them in the sidebar footer instead, above the cwd:branch line, marked with a bullet that is accented while the selection is pending and muted once it has been sent. With the sidebar hidden the label is not shown at all. The label was not derived purely from useEditorContext(): the prompt gated it on a prompt-local dismissedEditorSelectionKey signal, and that same gated selection is what the prompt attaches on submit. A sidebar reading the raw editor.selection() would advertise context in exactly the case where the prompt has dismissed it and won't send it. So the effective selection moves into the fork-only context/editor-label.tsx (selection/state/dismiss), mounted in app.tsx inside EditorContextProvider; the prompt's three remaining consumers read from it. Formatting and the view go to the fork-only sidebar/editor-context-label.tsx following the directory-label.tsx precedent — a pure function plus a presentational component, both testable without booting the app. Co-Authored-By: Claude Opus 4.8 (1M context) <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.
The prompt footer's right-side group is crowded, and the open editor file plus its selected range sit closer in kind to the sidebar's ambient session state than to the footer's keybind hints. They now render in the sidebar footer, above the
cwd:branchline, marked with a bullet that is accented while the selection is pending and muted once it has been sent.With the sidebar hidden the label is not shown at all — deliberately unlike the
cwd:branchtreatment in #70, which falls back to the footer.The part that wasn't just a move
The label was not derived purely from
useEditorContext(). The prompt gated it on a prompt-localdismissedEditorSelectionKeysignal, and that same gated selection is what the prompt attaches on submit. A sidebar reading the raweditor.selection()would advertise context in exactly the case where the prompt has dismissed it and won't send it.So the effective selection moves into the fork-only
src/context/editor-label.tsx(selection()/state()/dismiss()), mounted inapp.tsxinsideEditorContextProvider. The prompt's three remaining consumers — theprompt.editor_context.clearpredicate, the submit path, and the dismiss handler — read from it.Formatting and the view go to the fork-only
feature-plugins/sidebar/editor-context-label.tsx, following thedirectory-label.tsxprecedent: a pure function plus a presentational component, both testable without booting the app. The width cap is a constant 36 — the sidebar is a fixed 42 columns.Verification
bun typecheckclean inpackages/tuiandpackages/opencode.editor-context-label.test.ts,sidebar-footer-editor-label.test.tsx). Fullpackages/tuisuite: 242 pass / 1 fail — the known-flakyapp.exitepilogue test, confirmed failing on a stashed clean tree too.useEditorLabel()would throw and break the sidebar. It renders fine.Gap: the populated label is not verified end-to-end — that needs a connected VS Code/Zed pushing a real selection, which the verification environment doesn't have. The render tests cover the pending/sent/none views and the unit tests cover the formatting, but the live wire from an editor selection to those props is unverified by execution.
CHANGELOG.mdhas an Unreleased entry;DIVERGENCES.mdhas rows for all three upstream files touched (app.tsx,prompt/index.tsx,sidebar/footer.tsx). The two new files are fork-only and not tracked there.🤖 Generated with Claude Code