Skip to content

Commit 0416b59

Browse files
authored
joh/inquisitive meerkat (microsoft#184034)
* only stash sessions that are none empty microsoft/vscode-internalbacklog#4281 * only unstash a session once - unless new exchanges are made, microsoft/vscode-internalbacklog#4281 * account for all exchange types
1 parent 66ad45b commit 0416b59

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/vs/workbench/contrib/interactiveEditor/browser/interactiveEditorController.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -612,8 +612,13 @@ export class InteractiveEditorController implements IEditorContribution {
612612

613613
this[State.PAUSE]();
614614

615-
this._stashedSession.clear(); // !important that this isn't done with `value = ...`
616-
this._stashedSession.value = this._instaService.createInstance(StashedSession, this._editor, mySession);
615+
this._stashedSession.clear();
616+
if (!mySession.isUnstashed && mySession.lastExchange) {
617+
// only stash sessions that had edits
618+
this._stashedSession.value = this._instaService.createInstance(StashedSession, this._editor, mySession);
619+
} else {
620+
this._interactiveEditorSessionService.releaseSession(mySession);
621+
}
617622
}
618623

619624
// ---- controller API
@@ -766,6 +771,7 @@ class StashedSession {
766771
}
767772
this._listener.dispose();
768773
const result = this._session;
774+
result.markUnstashed();
769775
this._session = undefined;
770776
this._logService.debug('[IE] Unstashed session');
771777
return result;

src/vs/workbench/contrib/interactiveEditor/browser/interactiveEditorSession.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export class Session {
6161
private _lastExpansionState: boolean | undefined;
6262
private _lastTextModelChanges: LineRangeMapping[] | undefined;
6363
private _lastSnapshot: ITextSnapshot | undefined;
64+
private _isUnstashed: boolean = false;
6465
private readonly _exchange: SessionExchange[] = [];
6566
private readonly _startTime = new Date();
6667
private readonly _teldata: Partial<TelemetryData>;
@@ -88,6 +89,14 @@ export class Session {
8889
this._lastInput = input;
8990
}
9091

92+
get isUnstashed(): boolean {
93+
return this._isUnstashed;
94+
}
95+
96+
markUnstashed() {
97+
this._isUnstashed = true;
98+
}
99+
91100
get lastInput() {
92101
return this._lastInput;
93102
}
@@ -114,6 +123,7 @@ export class Session {
114123
}
115124

116125
addExchange(exchange: SessionExchange): void {
126+
this._isUnstashed = false;
117127
const newLen = this._exchange.push(exchange);
118128
this._teldata.rounds += `${newLen}|`;
119129
}

0 commit comments

Comments
 (0)