mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 21:55:38 +00:00
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:
parent
66ad45b79a
commit
0416b598e9
|
@ -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;
|
||||
|
|
|
@ -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}|`;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue