fix(sql-completion): improve MongoDB editor suggestions

This commit is contained in:
zipg authored and GitHub committed 2026-08-02 09:00:00 +08:00
1 parent b65962d46f
commit 9c8daa2bd4
6 files changed
+234 -50

No files matched your search

@@ -1018,10 +1018,11 @@ describe("currentExecutableStatementRange", () => {
expect(currentExecutableStatementRange(sql, indexOf(sql, "comment"), "redis")).toBeNull();
});
it("does not expose current statement framing for MongoDB", () => {
const sql = "db.users.find({})";
it("uses the current MongoDB command range", () => {
const sql = 'db.users.find({})\n\ndb.getCollection("audit.logs").countDocuments({})';
expect(currentExecutableStatementRange(sql, indexOf(sql, "users"), "mongodb")).toBeNull();
expect(currentExecutableStatementRange(sql, indexOf(sql, "users"), "mongodb")?.sql).toBe("db.users.find({})");
expect(currentExecutableStatementRange(sql, indexOf(sql, "audit.logs"), "mongodb")?.sql).toBe('db.getCollection("audit.logs").countDocuments({})');
});
});