fix(editor): smooth SQL editor state synchronization

This commit is contained in:
t8y2 committed 2026-09-09 22:34:52 +08:00
1 parent 7434295b1f
commit c8c7a40e46
4 files changed
+157 -33

No files matched your search

@@ -24,8 +24,8 @@ export interface SqlSemanticDiagnosticVisibleRange {
to: number;
}
export function sqlSemanticDiagnosticRangesForViewport(sql: string, visibleRanges: readonly SqlSemanticDiagnosticVisibleRange[], databaseType?: DatabaseType): SqlTextRange[] {
const statements = databaseType === "sqlserver" ? sqlServerSemanticDiagnosticRanges(sql) : executableStatementRanges(sql, databaseType);
export function sqlSemanticDiagnosticRangesForViewport(sql: string, visibleRanges: readonly SqlSemanticDiagnosticVisibleRange[], databaseType?: DatabaseType, cachedStatements?: readonly SqlTextRange[]): SqlTextRange[] {
const statements = databaseType === "sqlserver" ? sqlServerSemanticDiagnosticRanges(sql) : (cachedStatements ?? executableStatementRanges(sql, databaseType));
if (statements.length === 0 || visibleRanges.length === 0) return [];
const selected: SqlTextRange[] = [];