fix(cassandra): skip table alias completions for CQL

This commit is contained in:
thanhthai3010 authored and GitHub committed 2026-09-15 14:42:46 +08:00
1 parent 20e026eea9
commit 715d834c32
2 files changed
+34 -3

No files matched your search

@@ -581,6 +581,30 @@ describe("sqlCompletion table aliases", () => {
expect(table?.apply).toBe("order_items oi");
});
it("never adds generated aliases to Cassandra table completions", () => {
const sql = "SELECT * FROM ord";
const items = buildSqlCompletionItems(sql, sql.length, {
tables: [{ name: "order_items", type: "table" }],
columnsByTable: new Map(),
databaseType: "cassandra",
autoAliasTables: true,
});
const table = items.find((item) => item.label === "order_items" && item.type === "table");
expect(table?.apply).toBe("order_items");
});
it("does not suggest table aliases for Cassandra", () => {
const sql = "SELECT * FROM order_items ";
const items = buildSqlCompletionItems(sql, sql.length, {
tables: [{ name: "order_items", type: "table" }],
columnsByTable: new Map(),
databaseType: "cassandra",
});
expect(items.some((item) => item.type === "snippet" && item.detail === "alias for order_items")).toBe(false);
});
it("keeps plain table completions when generated aliases are disabled", () => {
const sql = "SELECT * FROM ord";
const items = buildSqlCompletionItems(sql, sql.length, {