feat(editor): add SQL execution target picker with preview decoration

When the user triggers SQL execution via shortcut/toolbar/context-menu
without a manual selection, a floating picker now surfaces the available
execution targets:

- "Current SQL" — the statement at the cursor
- "All SQL"   — the entire editor content

Each candidate is highlighted as a preview decoration in the editor as
the user navigates the picker with arrow keys. Only a single entry is
shown when the cursor statement equals the full document.

前端 SQL 范围解析器 (sqlStatementRanges.ts) 按分号拆分语句,同时跳过
字符串、引号标识符、注释和美元引用体中的分隔符,与后端 dbx-core splitter
逻辑一致。选取器支持键盘导航、鼠标悬停高亮、Enter 确认、Esc/失焦取消。

Changes:
- sqlExecutionTarget.ts: add SqlExecutionCandidate, SqlExecutionOverride types
- sqlStatementRanges.ts: frontend SQL tokeniser (new, 848 lines)
- SqlExecutionTargetPicker.vue: accessible floating listbox (new, 109 lines)
- QueryEditor.vue: preview StateEffect/StateField; requestExecute() replaces
  executeCurrentSql() to route through picker
- ContentArea.vue: expose requestQueryEditorExecute() to parent
- App.vue: toolbar + global shortcut → requestActiveEditorExecute()
- i18n: editor.executionPicker keys for all locales
- tests: 26 new unit tests for sqlStatementRanges (all 1121 tests pass)
This commit is contained in:
uicky authored and GitHub committed 2026-06-20 22:28:02 +08:00
1 parent 4590057456
commit 4d2afcad90
14 files changed
+1468 -10

No files matched your search

+7
View File
@@ -434,6 +434,13 @@ export default {
close: "Close (Esc)",
noResults: "No results",
},
executionPicker: {
title: "Execution Target",
currentStatement: "Current SQL",
allStatements: "All SQL",
currentCommand: "Current command",
allCommands: "All commands",
},
},
tabs: {
sql: "SQL",
+7
View File
@@ -408,6 +408,13 @@ export default {
close: "Cerrar (Esc)",
noResults: "Sin resultados",
},
executionPicker: {
title: "Execution Target",
currentStatement: "Current SQL",
allStatements: "All SQL",
currentCommand: "Current command",
allCommands: "All commands",
},
},
tabs: {
sql: "SQL",
+7
View File
@@ -413,6 +413,13 @@ export default {
close: "Chiudi (Esc)",
noResults: "Nessun risultato",
},
executionPicker: {
title: "Execution Target",
currentStatement: "Current SQL",
allStatements: "All SQL",
currentCommand: "Current command",
allCommands: "All commands",
},
},
tabs: {
sql: "SQL",
+7
View File
@@ -433,6 +433,13 @@ export default {
close: "閉じる (Esc)",
noResults: "結果なし",
},
executionPicker: {
title: "Execution Target",
currentStatement: "Current SQL",
allStatements: "All SQL",
currentCommand: "Current command",
allCommands: "All commands",
},
},
tabs: {
sql: "SQL",
+7
View File
@@ -413,6 +413,13 @@ export default {
close: "Fechar (Esc)",
noResults: "Nenhum resultado",
},
executionPicker: {
title: "Execution Target",
currentStatement: "Current SQL",
allStatements: "All SQL",
currentCommand: "Current command",
allCommands: "All commands",
},
},
tabs: {
sql: "SQL",
+7
View File
@@ -435,6 +435,13 @@ export default {
close: "关闭 (Esc)",
noResults: "无结果",
},
executionPicker: {
title: "执行目标",
currentStatement: "当前 SQL",
allStatements: "全部 SQL",
currentCommand: "当前命令",
allCommands: "全部命令",
},
},
tabs: {
sql: "SQL",
+7
View File
@@ -413,6 +413,13 @@ export default {
close: "關閉 (Esc)",
noResults: "無結果",
},
executionPicker: {
title: "執行目標",
currentStatement: "當前 SQL",
allStatements: "全部 SQL",
currentCommand: "目前命令",
allCommands: "全部命令",
},
},
tabs: {
sql: "SQL",