feat(editor): command palette (Ctrl+K) — every command searchable, with its live keybinding - #265
Conversation
|
Warning Review limit reached
Next review available in: 25 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughThe editor gains a Ctrl+K command palette with searchable shortcut and menu actions, keyboard selection, command execution, startup wiring, tests for filtering and entry construction, and changelog documentation. ChangesCommand palette
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant Editor as _editorRunEofCommand
participant Palette as command-palette.js
participant DOM as Palette DOM
User->>Editor: Press Ctrl+K
Editor->>Palette: Open command palette
Palette->>DOM: Render filtered commands
User->>Palette: Type query and select result
Palette->>Editor: Run command or menu function
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@CHANGELOG.md`:
- Around line 39-45: Update the Command palette changelog entry to reference the
Help ▸ Command palette menu path instead of View ▸ Command palette, leaving the
remaining description unchanged.
In `@src/command-palette.js`:
- Around line 177-182: Update the keydown handler on the command palette input
to handle the Tab key by preventing its default behavior and stopping
propagation, keeping focus trapped within the open palette while preserving the
existing Escape, arrow-key, and Enter handling.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 59da4ca8-459a-4cfd-ab96-51ae980d136b
📒 Files selected for processing (7)
CHANGELOG.mdscreen.htmlsrc/command-palette.jssrc/input.jssrc/main.jstests/command_palette.test.mjstests/screen_markup.test.mjs
abfdd8d to
af04447
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
New src/command-palette.js: fuzzy-searchable entries over the ready registry rows (live keybinding per active profile) plus menu window-fn actions; word-start > substring > subsequence ranking. Dispatcher and menu model arrive as init hooks (no input.js/menu-bar.js cycles). Replaces the openCommandPalette stub that opened the shortcut panel. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EBQCHCNA81E9tHmSDHSe2Q
_editorLoadShortcutProfile() returns nothing — passing its result pinned the palette's displayed keys to the FeedBack profile regardless of the active one. Use the live editorShortcutProfile binding instead.
The palette is a CLICK on a command, not a keypress, so it belongs on `editorRunShortcutCommand` — the same by-id path the shortcut panel's buttons already use — not on `_editorRunEofCommand`, the raw keyboard switch underneath it. Going straight to the raw switch left the three digit-RANGE registry rows silently inert: "Set selected fret 0-9", "Jump to bookmark 1-9" and "Set / clear bookmark 1-9 at cursor" are all `status: 'ready'`, so the palette listed them, but `_editorRunEofCommand` only knows the per-digit forms (`setFretDigit:<n>`, `gotoBookmark:<n>`, …). The bare id fell through to `default: return false` — palette closes, nothing happens, no status. The explain-hint that turns those rows into "Press 0-9 to set the selected note fret" lives in `editorRunShortcutCommand`, which is exactly the path the panel takes and the palette now takes too. Also: - The palette no longer lists itself. `openCommandPalette` is a ready registry row (and a View menu row), so it surfaced as a hit that closed the palette and immediately reopened it. - Escape closes from anywhere. The backdrop only covers #editor-canvas-wrap, so a click on the menu bar or a toolbar moved focus out while the overlay stayed up — and the input's keydown handler, the only Escape path, could no longer see the key. main.js's global dialog listener now closes it, as it does for the other overlays. - Close restores the element that had focus before the palette took it, rather than blurring whatever happens to be active. - Drop the unused `_paletteOpen` export. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- The changelog pointed at "View ▸ Command palette"; the `openCommandPalette` row actually lives in the HELP menu (menu-bar.js). "View" is its registry *group* (the shortcut-panel heading), not its menu. - Trap Tab. The input is the palette's only focusable node, so Tab walked focus into the page behind the open overlay; swallow it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
d46ac81 to
f09713a
Compare
What
The biggest discoverability lever available: two testers in one night reported features as missing that already existed (Resnap, bulk barline moves). The palette makes every feature findable by typing what you want.
status: 'ready'registry command with its live keybinding for the active shortcut profile, plus every menu action that dispatches a window-fn (the dialog-openers — Scan for tempo zones, Replace audio, User Guide…).cmd:menu rows are skipped as registry duplicates; separators/headers never leak._editorRunEofCommand— the exact dispatcher the keyboard uses — and menu actions throughwindow[fn], exactly as the menu bar dispatches them. Both arrive as init hooks socommand-palette.jsimports neitherinput.jsnormenu-bar.js(each would close an import cycle).Tests
tests/command_palette.test.mjs(4, fail on main — the module doesn't exist): entry building (ready-only, live keys, menu-fn inclusion, dupe/chrome exclusion), the three-tier ranking, group-aware search, browse/limit/no-match.screen_markup.test.mjsextended to pin the overlay's nesting. Full suite 147 green, lint 0 errors,routes.pyuntouched.Live-verified
Real pak: Ctrl+K opens focused with a 12-row browse list; typing "resnap" surfaces "Resnap selection to grid — Shift+R" and Enter dispatches the real command (status "Select notes first"); "user guide" + Enter opens the Help ▸ User Guide modal through the window-fn path; Esc closes clean. Zero page errors.
Note
Song Fit isn't listed — it has no registry id and no menu row (it lives on the tempo-inspector button). The upcoming keybind-profiles PR is the natural place to registry-register it so it becomes palette-findable.
🤖 Generated with Claude Code
https://claude.ai/code/session_01EBQCHCNA81E9tHmSDHSe2Q
Summary by CodeRabbit