Repository navigation
feat: industry-standard keyboard shortcuts + 2 bug fixes - #233
Merged
Merged
Conversation
Two parallel research agents audited SQLPilot against SQuirreL,
HeidiSQL, MySQL Workbench, DBeaver, DataGrip, Navicat, TablePlus,
pgAdmin, Postico, SQLTools (VS Code). Landed the small wins + the
two bugs they uncovered in one shot.
## Bugs fixed
1. Ctrl+Shift+A (Explain Analyze) was advertised in ShortcutsDialog
but no Monaco action existed. Pressing it did nothing. Now: real
Monaco action wired to executeExplainAnalyze.
2. F5 was double-bound to two conflicting semantics:
- useKeyboardShortcuts.ts -> F5 = 'execute query whole tab'
- src-tauri/src/menu.rs -> F5 = 'Refresh Schema'
Industry consensus (8/10 tools: DBeaver, HeidiSQL, pgAdmin, Navicat,
MySQL Workbench, TablePlus, DataGrip, SQLTools) says F5 = Refresh
Schema. Resolved by:
- Removed F5 from useKeyboardShortcuts.ts execute-all path.
- Added a Monaco action 'refresh-schema' with F5 keybinding so the
bind works inside the editor too.
- Left Tauri menu.rs F5 = refresh-schema as-is.
Ctrl+Shift+Enter remains the only 'execute all' binding.
3. Ctrl+Shift+F collision with Format SQL. SchemaTree filter input
focus was on Ctrl+Shift+F, colliding with Format SQL when both
Monaco was focused and the tree visible. Rebound to Ctrl+Shift+O.
## New Monaco actions (SQLEditor.tsx)
- explain-analyze: Ctrl+Shift+A (fixes #1)
- lowercase-selected: Ctrl+Shift+L (industry standard, 8/10 tools)
- uppercase-selected: Ctrl+Shift+U (industry standard, 8/10 tools)
- refresh-schema: F5 (fixes #2)
## New app-level shortcuts (useKeyboardShortcuts.ts)
- Ctrl+B: toggle sidebar (alias for Ctrl+Shift+C; 8/10 industry tools
use Ctrl+B). Both bindings work.
- Ctrl+1..9: switch to tab by index (industry standard 6/10).
## Docs updated (ShortcutsDialog.tsx)
- Removed F5 = Run all statements (now = Refresh schema)
- Added Monaco-default entries (Ctrl+/, Ctrl+D, Alt+Up/Down, F12)
that were previously undocumented
- Toggle sidebar shows both Ctrl+B / Ctrl+Shift+C
- Switch to tab by index shows Ctrl+1..9
- Focus schema tree filter shows Ctrl+Shift+O (was Ctrl+Shift+F)
## Tests
- Delete obsolete F5 app-level execute query block (5 tests removed).
- Add ShortcutsDialog tests for new entries.
- Add useKeyboardShortcuts tests for Ctrl+B and Ctrl+1..9 (5 cases).
- Add SQLEditor browser tests for new Monaco actions (8 tests covering
registration + run() delegation for explain-analyze, refresh-schema,
lowercase, uppercase).
Total: ~16 added, ~5 removed. vitest full: 1462/1462 pass (was 1453).
## Out of scope (deliberate)
Industry research surfaced several larger asks that need new UI
components / store work and are better as separate PRs or issues:
- Command palette (Ctrl+Shift+P)
- Quick file/tab switcher (Ctrl+P)
- Restore closed tab (Ctrl+Shift+T) -- needs tab history in editorStore
- Query history view (no history UI yet)
- Settings dialog (Ctrl+,) -- no global settings dialog exists
- Inline commit pending grid edits, add/delete/duplicate row from grid
- "Cancel running query" -- low industry prevalence + Escape
interference
Items NOT changed but worth flagging:
- Ctrl+Shift+C for sidebar kept as alias alongside new Ctrl+B
- shortcut choices follow industry consensus except where SQLPilot's
choice was already better
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.
What
Two parallel research agents (audit + industry research) surfaced the gaps; this PR lands the small wins + 2 bugs they uncovered in one shot.
Bugs fixed
ShortcutsDialogbut no Monaco action existed. Now: real action wired toexecuteExplainAnalyze.useKeyboardShortcuts.ts:26said execute,src-tauri/src/menu.rs:67said refresh schema). 8/10 industry tools use F5 = refresh. Resolved: removed F5 from app-level execute-all; added Monacorefresh-schemaaction on F5; left Tauri menu F5 = refresh-schema as-is. Ctrl+Shift+Enter remains the only execute-all binding.New Monaco actions (
SQLEditor.tsx)explain-analyze: Ctrl+Shift+Alowercase-selected: Ctrl+Shift+L (8/10 industry tools)uppercase-selected: Ctrl+Shift+U (8/10 industry tools)refresh-schema: F5New app-level shortcuts (
useKeyboardShortcuts.ts)Documented in
ShortcutsDialog.tsxF5 = Run all statements(F5 = Refresh schemanow)'Ctrl+Enter / F9')Out of scope (deliberate)
These need new UI components / store work — landed as follow-up issues rather than this PR:
Verification
npx vitest run(full)npm run type-checknpx eslint(touched files)npx dprint checkFiles
src/components/editor/SQLEditor.tsx(+62 / -0) — 4 new Monaco actionssrc/components/editor/__tests__/SQLEditor.browser.test.tsx(+87 / -3) — 8 new testssrc/hooks/useKeyboardShortcuts.ts(+14 / -14) — drop F5, add Ctrl+B + Ctrl+1..9src/hooks/__tests__/useKeyboardShortcuts.test.ts(+97 / -116) — rewrite of F5 block, new tests for Ctrl+B and Ctrl+1..9src/components/schema/SchemaTree.tsx(+2 / -2) — filter focus Ctrl+Shift+F -> Ctrl+Shift+Osrc/components/common/ShortcutsDialog.tsx(+15 / -9) — updated labels, new entriessrc/components/common/__tests__/ShortcutsDialog.test.tsx(+25 / -2) — Monaco-default + Ctrl+B + Ctrl+1..9 assertionsNet: +335 / -117 across 7 files.