Skip to content

feat: industry-standard keyboard shortcuts + 2 bug fixes - #233

Merged
EVWorth merged 1 commit into
mainfrom
feat/industry-shortcuts-land-all
Jul 20, 2026
Merged

EVWorth merged 1 commit into
mainfrom
feat/industry-shortcuts-land-all

Conversation

@EVWorth

@EVWorth EVWorth commented Jul 20, 2026

Copy link
Copy Markdown
Owner

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

  1. Ctrl+Shift+A (Explain Analyze) was advertised in ShortcutsDialog but no Monaco action existed. Now: real action wired to executeExplainAnalyze.
  2. F5 was double-bound to two conflicting semantics (useKeyboardShortcuts.ts:26 said execute, src-tauri/src/menu.rs:67 said refresh schema). 8/10 industry tools use F5 = refresh. Resolved: removed F5 from app-level execute-all; added Monaco refresh-schema action on F5; left Tauri menu F5 = refresh-schema as-is. Ctrl+Shift+Enter remains the only execute-all binding.
  3. Ctrl+Shift+F collision (Format SQL vs SchemaTree filter focus). Rebound SchemaTree filter to Ctrl+Shift+O.

New Monaco actions (SQLEditor.tsx)

  • explain-analyze: Ctrl+Shift+A
  • lowercase-selected: Ctrl+Shift+L (8/10 industry tools)
  • uppercase-selected: Ctrl+Shift+U (8/10 industry tools)
  • refresh-schema: F5

New app-level shortcuts (useKeyboardShortcuts.ts)

  • Ctrl+B: toggle sidebar (alias for Ctrl+Shift+C; 8/10 industry tools use Ctrl+B).
  • Ctrl+1..9: switch to tab by index (industry standard 6/10).

Documented in ShortcutsDialog.tsx

  • Removed F5 = Run all statements (F5 = Refresh schema now)
  • Added Monaco defaults that were previously undocumented: Ctrl+/, Ctrl+Shift+/, Ctrl+D, Alt+Up/Down, F12
  • Documented new shortcuts: Ctrl+B, Ctrl+1..9, Ctrl+Shift+O, Ctrl+Shift+L/U
  • Combined F9 into the Ctrl+Enter entry ('Ctrl+Enter / F9')

Out of scope (deliberate)

These need new UI components / store work — landed as follow-up issues rather than this PR:

  • Command palette (Ctrl+Shift+P)
  • Quick file/tab switcher (Ctrl+P)
  • Restore closed tab (Ctrl+Shift+T) — needs tab history
  • Query history view
  • Settings dialog (Ctrl+,) — no global settings dialog exists yet
  • Inline commit pending grid edits, add/delete/duplicate row from grid
  • Cancel running query — low industry prevalence + Escape interference risk

Verification

npx vitest run (full) 77 files / 1462 tests pass (was 1453, +9 net)
npm run type-check 0 errors
npx eslint (touched files) 0 errors
npx dprint check clean
Lefthook pre-commit (all 7 commands) all green

Files

  • src/components/editor/SQLEditor.tsx (+62 / -0) — 4 new Monaco actions
  • src/components/editor/__tests__/SQLEditor.browser.test.tsx (+87 / -3) — 8 new tests
  • src/hooks/useKeyboardShortcuts.ts (+14 / -14) — drop F5, add Ctrl+B + Ctrl+1..9
  • src/hooks/__tests__/useKeyboardShortcuts.test.ts (+97 / -116) — rewrite of F5 block, new tests for Ctrl+B and Ctrl+1..9
  • src/components/schema/SchemaTree.tsx (+2 / -2) — filter focus Ctrl+Shift+F -> Ctrl+Shift+O
  • src/components/common/ShortcutsDialog.tsx (+15 / -9) — updated labels, new entries
  • src/components/common/__tests__/ShortcutsDialog.test.tsx (+25 / -2) — Monaco-default + Ctrl+B + Ctrl+1..9 assertions

Net: +335 / -117 across 7 files.

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
@EVWorth
EVWorth merged commit 41b4b0b into main Jul 20, 2026
1 check failed
@EVWorth
EVWorth deleted the feat/industry-shortcuts-land-all branch July 20, 2026 02:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant