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): include sqlserver temp-table prefix in word selection

Melody Ruch6a5bfb69365c
diff --git a/apps/desktop/src/lib/__tests__/editor/queryEditorLineComment.spec.ts b/apps/desktop/src/lib/__tests__/editor/queryEditorLineComment.spec.ts
index af57bc884c..6389cbfcf9 100644
--- a/apps/desktop/src/lib/__tests__/editor/queryEditorLineComment.spec.ts
+++ b/apps/desktop/src/lib/__tests__/editor/queryEditorLineComment.spec.ts
@@ -57,6 +57,17 @@ describe("QueryEditor word selection", () => {
expect(mysql.wordAt(2)).toMatchObject({ from: 1, to: 5 });
expect(systemVariable.wordAt(1)).toMatchObject({ from: 0, to: 10 });
});
+
+ it("includes the # prefix in SQL Server temp table words", () => {
+ const create = (doc: string, dbType: "sqlserver" | "mysql") => EditorState.create({ doc, extensions: [EditorState.languageData.of(() => queryEditorWordLanguageData(dbType))] });
+ const local = create("#order", "sqlserver");
+ const global = create("##order", "sqlserver");
+ const mysql = create("#order", "mysql");
+
+ for (let position = 0; position <= 6; position += 1) expect(local.wordAt(position)).toMatchObject({ from: 0, to: 6 });
+ for (let position = 0; position <= 7; position += 1) expect(global.wordAt(position)).toMatchObject({ from: 0, to: 7 });
+ expect(mysql.wordAt(3)).toMatchObject({ from: 1, to: 6 });
+ });
});
describe("QueryEditor line comment", () => {
diff --git a/apps/desktop/src/lib/editor/queryEditorLineComment.ts b/apps/desktop/src/lib/editor/queryEditorLineComment.ts
index 7408895b91..faa786fbe1 100644
--- a/apps/desktop/src/lib/editor/queryEditorLineComment.ts
+++ b/apps/desktop/src/lib/editor/queryEditorLineComment.ts
@@ -20,5 +20,5 @@ export function queryEditorCommentTokens(dbType?: DatabaseType) {
}
export function queryEditorWordLanguageData(dbType?: DatabaseType) {
- return dbType === "sqlserver" ? [{ wordChars: "@" }] : [];
+ return dbType === "sqlserver" ? [{ wordChars: "@#" }] : [];
}