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): cover cross-database column completion
t8y263ff9321a451
diff --git a/apps/desktop/src/lib/__tests__/sql/sqlCompletion.context.spec.ts b/apps/desktop/src/lib/__tests__/sql/sqlCompletion.context.spec.tsindex b0fa4f26cf..ca6e2140f0 100644--- a/apps/desktop/src/lib/__tests__/sql/sqlCompletion.context.spec.ts+++ b/apps/desktop/src/lib/__tests__/sql/sqlCompletion.context.spec.ts@@ -243,6 +243,30 @@ describe("sqlCompletion scoped context classification", () => {expect(context.referencedTables).toEqual(expect.arrayContaining([expect.objectContaining({ name: "sq", alias: "sq", columns: ["id", "user_name"] })]));});++ it("suggests columns for cross-database qualified table references", () => {+ const sql = "SELECT * FROM current_orders WHERE reporting.orders.";+ const context = getSqlCompletionContext(sql, sql.length);+ const items = buildSqlCompletionItems(sql, sql.length, {+ tables: [],+ columnsByTable: new Map([+ [+ "reporting.orders",+ [+ { name: "id", table: "orders", schema: "reporting", dataType: "int" },+ { name: "status", table: "orders", schema: "reporting", dataType: "varchar" },+ ],+ ],+ ["archive.orders", [{ name: "archived_at", table: "orders", schema: "archive", dataType: "datetime" }]],+ ]),+ });++ expect(context.qualifier).toBe("reporting.orders");+ expect(context.qualifierParts).toEqual(["reporting", "orders"]);+ expect(context.suggestColumns).toBe(true);+ expect(items).toEqual(expect.arrayContaining([expect.objectContaining({ label: "id", type: "column" }), expect.objectContaining({ label: "status", type: "column" })]));+ expect(items.some((item) => item.label === "archived_at")).toBe(false);+ });});describe("sqlCompletion scoped metadata ranking", () => {