Skip to content

armgit / dbx

Public Imported from GitHub
0

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。

fix(editor): keep cursor at end of inserted completion text (#1136)

dbin01232ef29c004a40
diff --git a/apps/desktop/src/components/editor/QueryEditor.vue b/apps/desktop/src/components/editor/QueryEditor.vue
index 2e69401b38..855c3168ac 100644
--- a/apps/desktop/src/components/editor/QueryEditor.vue
+++ b/apps/desktop/src/components/editor/QueryEditor.vue
@@ -868,7 +868,11 @@ function completionOptionForItem(item: QueryCompletionItem) {
if (typeof originalApply === "function") {
originalApply(view, completionItem as never, from, to);
} else {
- view.dispatch({ changes: { from, to, insert: String(originalApply ?? item.label) } });
+ const insert = String(originalApply ?? item.label);
+ view.dispatch({
+ changes: { from, to, insert },
+ selection: { anchor: from + insert.length },
+ });
}
},
};
@@ -881,7 +885,11 @@ function completionOptionForItem(item: QueryCompletionItem) {
boost: item.boost,
apply(view: EditorViewType, _completionItem: unknown, from: number, to: number) {
record();
- view.dispatch({ changes: { from, to, insert: item.apply ?? item.label } });
+ const insert = item.apply ?? item.label;
+ view.dispatch({
+ changes: { from, to, insert },
+ selection: { anchor: from + insert.length },
+ });
},
};
}