fix(editor): move large SQL analysis off the input path

This commit is contained in:
t8y2 committed 2026-09-28 07:24:23 +08:00
1 parent 0a6ab8d360
commit adaaec5a3c
30 files changed
+1241 -211

No files matched your search

+2 -2
View File
@@ -1816,7 +1816,7 @@ class SqlCompletionProvider {
}
}
export function shouldAutoOpenSqlCompletion(sql: string, cursor: number, options: SqlSemanticBuildOptions = {}): boolean {
export function shouldAutoOpenSqlCompletion(sql: string, cursor: number, options: SqlSemanticBuildOptions = {}, precomputedContext?: SqlCompletionContext): boolean {
if (getPostgresSequenceLiteralCompletionContext(sql, cursor, options.databaseType)) return true;
if (isSqlCompletionSuppressedContext(sql, cursor, options)) return false;
const previousChar = sql[cursor - 1];
@@ -1830,7 +1830,7 @@ export function shouldAutoOpenSqlCompletion(sql: string, cursor: number, options
if (/\bon\s+$/i.test(beforeCursor)) return true;
if (isAfterJoinModifierContext(beforeCursor, options.databaseType)) return true;
if (/\bcall\s+(?:[A-Za-z_][\w$]*\.)?$/i.test(beforeCursor)) return true;
const context = getSqlCompletionContext(sql, cursor, options);
const context = precomputedContext ?? getSqlCompletionContext(sql, cursor, options);
if (previousChar === "(" && (context.insertTable || context.preferredValueKeywords?.length)) return true;
if (/[,;()[\]]/.test(previousChar)) return false;
if (context.exclusiveTableSuggestions || context.exclusiveRoutineSuggestions || context.suggestTables) {