fix(editor): restore quoted table keyword completion

This commit is contained in:
ekesaiting authored and GitHub committed 2026-08-01 02:19:10 +08:00
1 parent 61e149bb9f
commit 7cf5795666
3 files changed
+44 -5

No files matched your search

@@ -469,4 +469,20 @@ WHERE a.id = b.fk_kpi_set_score_id`,
expect(context.suggestTables).toBe(true);
expect(items.filter((item) => item.type === "table").map((item) => item.label)).toEqual(["orders"]);
});
it.each([
["PostgreSQL quoted table", 'SELECT * FROM "users" wh|', "postgres", "postgres"],
["PostgreSQL quoted schema.table", 'SELECT * FROM "public"."users" wh|', "postgres", "postgres"],
["PostgreSQL quoted keyword table", 'SELECT * FROM "from" wh|', "postgres", "postgres"],
["PostgreSQL quoted schema.keyword table", 'SELECT * FROM "public"."from" wh|', "postgres", "postgres"],
["MySQL backtick table", "SELECT * FROM `users` wh|", "mysql", "mysql"],
["MySQL backtick keyword table", "SELECT * FROM `join` wh|", "mysql", "mysql"],
["SQL Server bracket table", "SELECT * FROM [users] wh|", "sqlserver", "sqlserver"],
["SQL Server bracket keyword table", "SELECT * FROM [update] wh|", "sqlserver", "sqlserver"],
] as const)("offers WHERE keyword completion after a quoted prefilled table (%s)", (_label, markedSql, databaseType, dialect) => {
const { context, items } = semanticCompletion(markedSql, {}, { databaseType, dialect });
expect(context.suggestKeywords).toBe(true);
expect(items.filter((item) => item.type === "keyword").map((item) => item.label)).toEqual(expect.arrayContaining(["WHERE", "WHEN", "WITH"]));
});
});