25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
fix(editor): preserve snippet tab navigation
t8y2dfd1e7e6d197
diff --git a/apps/desktop/src/components/editor/QueryEditor.vue b/apps/desktop/src/components/editor/QueryEditor.vueindex 6ef6e69af7..079666aa40 100644--- a/apps/desktop/src/components/editor/QueryEditor.vue+++ b/apps/desktop/src/components/editor/QueryEditor.vue@@ -201,6 +201,8 @@ let codeMirrorSnippetCompletion: typeof import("@codemirror/autocomplete").snipplet codeMirrorCompletionStatus: typeof import("@codemirror/autocomplete").completionStatus | null = null;let codeMirrorAcceptCompletion: typeof import("@codemirror/autocomplete").acceptCompletion | null = null;let codeMirrorStartCompletion: typeof import("@codemirror/autocomplete").startCompletion | null = null;+let codeMirrorInsertCompletionText: typeof import("@codemirror/autocomplete").insertCompletionText | null = null;+let codeMirrorNextSnippetField: typeof import("@codemirror/autocomplete").nextSnippetField | null = null;let codeMirrorIndentMore: typeof import("@codemirror/commands").indentMore | null = null;let codeMirrorIndentLess: typeof import("@codemirror/commands").indentLess | null = null;let codeMirrorCopyLineDown: typeof import("@codemirror/commands").copyLineDown | null = null;@@ -653,7 +655,7 @@ function runKeymapExtension(codeMirrorKeymap: (typeof import("@codemirror/view")]),) ?? [],codeMirrorKeymap.of(- binding(shortcuts.acceptCompletion, (view) => codeMirrorAcceptCompletion?.(view) ?? false).map((item) => ({+ binding(shortcuts.acceptCompletion, acceptCompletionOrNextSnippetField).map((item) => ({...item,preventDefault: false,})),@@ -661,6 +663,15 @@ function runKeymapExtension(codeMirrorKeymap: (typeof import("@codemirror/view")];}+function acceptCompletionOrNextSnippetField(view: EditorViewType): boolean {+ if (codeMirrorCompletionStatus?.(view.state) && (codeMirrorAcceptCompletion?.(view) ?? false)) {+ return true;+ }+ // Table/column completions can happen inside a CodeMirror snippet field. When+ // the completion popup is gone, Tab should continue through the snippet fields.+ return codeMirrorNextSnippetField?.(view) ?? false;+}+function wordWrapExtension() {if (!editorViewModule) return [];return props.forceWordWrap || settingsStore.editorSettings.wordWrap ? editorViewModule.EditorView.lineWrapping : [];@@ -1341,10 +1352,14 @@ function completionOptionForItem(item: QueryCompletionItem) {apply(view: EditorViewType, _completionItem: unknown, from: number, to: number) {record();const insert = item.apply ?? item.label;- view.dispatch({- changes: { from, to, insert },- selection: { anchor: from + insert.length },- });+ if (codeMirrorInsertCompletionText) {+ view.dispatch(codeMirrorInsertCompletionText(view.state, insert, from, to));+ } else {+ view.dispatch({+ changes: { from, to, insert },+ selection: { anchor: from + insert.length },+ });+ }},};}@@ -2009,7 +2024,7 @@ onMounted(async () => {{ EditorView, keymap, rectangularSelection, hoverTooltip, showTooltip, Decoration, tooltips, gutter, GutterMarker, lineNumbers, highlightActiveLineGutter, highlightSpecialChars, drawSelection, dropCursor, crosshairCursor, ViewPlugin },{ EditorState, Compartment, Prec, StateEffect, StateField },langSql,- { autocompletion, startCompletion, acceptCompletion, closeBrackets, closeBracketsKeymap, snippetCompletion, completionStatus, completionKeymap },+ { autocompletion, startCompletion, acceptCompletion, closeBrackets, closeBracketsKeymap, snippetCompletion, completionStatus, completionKeymap, insertCompletionText, nextSnippetField },{ copyLineDown, copyLineUp, deleteLine, indentLess, indentMore, insertNewlineKeepIndent, moveLineDown, moveLineUp, redo, selectAll, undo, history, defaultKeymap, historyKeymap },{ bracketMatching, foldGutter, indentOnInput, indentUnit, syntaxHighlighting, defaultHighlightStyle, foldKeymap },{ searchKeymap },@@ -2030,6 +2045,8 @@ onMounted(async () => {codeMirrorCompletionStatus = completionStatus;codeMirrorAcceptCompletion = acceptCompletion;codeMirrorStartCompletion = startCompletion;+ codeMirrorInsertCompletionText = insertCompletionText;+ codeMirrorNextSnippetField = nextSnippetField;codeMirrorIndentMore = indentMore;codeMirrorIndentLess = indentLess;codeMirrorCopyLineDown = copyLineDown;