feat(completion): expand INSERT all-columns with VALUES tab stops

This commit is contained in:
zipg authored and GitHub committed 2026-08-09 23:24:36 +08:00
1 parent 295c260a72
commit 5966aea43b
3 files changed
+26 -12

No files matched your search

@@ -417,7 +417,17 @@ WHERE a.id = b.fk_kpi_set_score_id`,
const { context, items } = semanticCompletion("INSERT INTO users (|", { columnsByTable });
expect(context.insertTable).toBe("users");
expect(items.find((item) => item.type === "snippet" && item.label === "users.*")?.apply).toBe("id, name, email");
const allColumns = items.find((item) => item.type === "snippet" && item.label === "users.*");
expect(allColumns?.apply).toBe("id, name, email) VALUES (${1:value}, ${2:value}, ${3:value})");
expect(allColumns?.detail).toBe("3 columns: id, name, email) VALUES (value, value, value)");
});
it("uses the configured keyword case for INSERT all-column snippets", () => {
const columnsByTable = new Map<string, SqlCompletionColumn[]>([["users", ["id", "name"].map((name) => ({ name, table: "users" }))]]);
const { items } = semanticCompletion("insert into users (|", { columnsByTable, keywordCase: "lower" });
expect(items.find((item) => item.type === "snippet" && item.label === "users.*")?.apply).toBe("id, name) values (${1:value}, ${2:value})");
});
it("keeps partial INSERT INTO targets in table completion context", () => {