fix(query): preserve selected statement source range

This commit is contained in:
t8y2 committed 2026-07-13 19:57:35 +08:00
1 parent 6bd49fcd19
commit 8cebc4a366
10 files changed
+127 -32

No files matched your search

@@ -8,6 +8,8 @@ export interface SqlExecutionSnapshot {
fullSql: string;
selectedSql: string;
cursorPos: number;
selectionFrom: number;
selectionTo: number;
}
export type SqlExecutionOverride = string | SqlExecutionSnapshot;
@@ -35,7 +37,7 @@ export interface SqlExecutionChoiceRequest {
}
export function isSqlExecutionSnapshot(value: SqlExecutionOverride | undefined): value is SqlExecutionSnapshot {
return typeof value === "object" && value !== null && typeof value.fullSql === "string" && typeof value.selectedSql === "string" && typeof value.cursorPos === "number";
return typeof value === "object" && value !== null && typeof value.fullSql === "string" && typeof value.selectedSql === "string" && typeof value.cursorPos === "number" && typeof value.selectionFrom === "number" && typeof value.selectionTo === "number";
}
export function resolveExecutableSql(fullSql: string, selectedSql: string, options?: { mode?: ExecuteMode; cursorPos?: number }): string {