joh/inquisitive meerkat (#184034)

* only stash sessions that are none empty

https://github.com/microsoft/vscode-internalbacklog/issues/4281

* only unstash a session once - unless new exchanges are made,

https://github.com/microsoft/vscode-internalbacklog/issues/4281

* account for all exchange types
This commit is contained in:
Johannes Rieken 2023-06-01 11:31:31 +02:00 committed by GitHub
parent 66ad45b79a
commit 0416b598e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 2 deletions

View file

@ -612,8 +612,13 @@ export class InteractiveEditorController implements IEditorContribution {
this[State.PAUSE]();
this._stashedSession.clear(); // !important that this isn't done with `value = ...`
this._stashedSession.value = this._instaService.createInstance(StashedSession, this._editor, mySession);
this._stashedSession.clear();
if (!mySession.isUnstashed && mySession.lastExchange) {
// only stash sessions that had edits
this._stashedSession.value = this._instaService.createInstance(StashedSession, this._editor, mySession);
} else {
this._interactiveEditorSessionService.releaseSession(mySession);
}
}
// ---- controller API
@ -766,6 +771,7 @@ class StashedSession {
}
this._listener.dispose();
const result = this._session;
result.markUnstashed();
this._session = undefined;
this._logService.debug('[IE] Unstashed session');
return result;

View file

@ -61,6 +61,7 @@ export class Session {
private _lastExpansionState: boolean | undefined;
private _lastTextModelChanges: LineRangeMapping[] | undefined;
private _lastSnapshot: ITextSnapshot | undefined;
private _isUnstashed: boolean = false;
private readonly _exchange: SessionExchange[] = [];
private readonly _startTime = new Date();
private readonly _teldata: Partial<TelemetryData>;
@ -88,6 +89,14 @@ export class Session {
this._lastInput = input;
}
get isUnstashed(): boolean {
return this._isUnstashed;
}
markUnstashed() {
this._isUnstashed = true;
}
get lastInput() {
return this._lastInput;
}
@ -114,6 +123,7 @@ export class Session {
}
addExchange(exchange: SessionExchange): void {
this._isUnstashed = false;
const newLen = this._exchange.push(exchange);
this._teldata.rounds += `${newLen}|`;
}