feat(sqlCompletion): support insert all-column completion
This commit is contained in:
1 parent
4afc3297e1
commit
3fdcc2d454
4 files changed
+152
-15
No files matched your search
@@ -88,4 +88,13 @@ describe("semantic SQL completion candidates", () => {
|
||||
|
||||
expect(items.find((item) => item.label === "User Name")?.apply).toBe('"User Name"');
|
||||
});
|
||||
|
||||
it("suggests all target columns for insert column lists", () => {
|
||||
const columnsByTable = new Map<string, SqlCompletionColumn[]>([["users", ["id", "name", "email"].map((name) => ({ name, table: "users" }))]]);
|
||||
|
||||
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");
|
||||
});
|
||||
});
|
||||
@@ -160,7 +160,7 @@ describe("sqlCompletion scoped context classification", () => {
|
||||
|
||||
expect(context.contextKind).toBe("column");
|
||||
expect(context.insertSchema).toBe("dbo");
|
||||
expect(context.insertTable).toBe("users");
|
||||
expect(context.insertTable).toBe("Users");
|
||||
expect(context.exclusiveColumnSuggestions).toBe(true);
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user