fix(completion): scoped table lookup, preserve casing, lower Oracle table-function boost
* fix: improve schema-qualified SQL completion * fix(completion): preserve casing in completion table cache key and relaxed filter --------- Co-authored-by: zipg <4047349+zipg@users.noreply.github.com> Co-authored-by: t8y2 <1156263951@qq.com>
This commit is contained in:
5 files changed
+51
-9
No files matched your search
@@ -271,4 +271,15 @@ describe("sqlCompletion scoped metadata ranking", () => {
|
||||
expect(items.length).toBeLessThanOrEqual(200);
|
||||
expect(items[0]?.label).toBe("TempTable_000");
|
||||
});
|
||||
|
||||
it("ranks real Oracle tables before built-in table functions in FROM contexts", () => {
|
||||
const sql = "SELECT * FROM ";
|
||||
const items = buildSqlCompletionItems(sql, sql.length, {
|
||||
databaseType: "oracle",
|
||||
tables: [{ name: "ORDERS_10K", schema: "DBX_TEST", type: "table" }],
|
||||
columnsByTable: new Map(),
|
||||
});
|
||||
|
||||
expect(items.findIndex((item) => item.label === "ORDERS_10K")).toBeLessThan(items.findIndex((item) => item.label === "TABLE"));
|
||||
});
|
||||
});
|
||||
@@ -2729,7 +2729,7 @@ function buildOracleTableFunctionItems(prefix: string): SqlCompletionItem[] {
|
||||
.map((item) => ({
|
||||
...item,
|
||||
type: "function" as const,
|
||||
boost: computeBoost(item.label, prefix) + 2200,
|
||||
boost: computeBoost(item.label, prefix) + 600,
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user