no undoStops between streaming edits, esp not between last and second to last round (#196708)

fixes https://github.com/microsoft/vscode-copilot/issues/2403
This commit is contained in:
Johannes Rieken
2023-10-26 15:21:08 +02:00
committed by GitHub
parent 4422a67059
commit 9f627c21f6
3 changed files with 49 additions and 8 deletions

View File

@@ -225,7 +225,6 @@ class InlineDiffDecorations {
export interface ProgressingEditsOptions {
duration: number;
round: number;
token: CancellationToken;
}
@@ -328,8 +327,9 @@ export class LiveStrategy extends EditModeStrategy {
override async makeProgressiveChanges(edits: ISingleEditOperation[], opts: ProgressingEditsOptions): Promise<void> {
if (opts.round === 0) {
this._session.textModelN.pushStackElement();
// push undo stop before first edit
if (++this._editCount === 1) {
this._editor.pushUndoStop();
}
const durationInSec = opts.duration / 1000;
@@ -591,14 +591,16 @@ export function asProgressiveEdit(edit: IIdentifiedSingleEditOperation, wordsPer
if (r.isFullString) {
clearInterval(handle);
stream.resolve();
d.dispose();
}
}, 1000 / wordsPerSec);
// cancel ASAP
token.onCancellationRequested(() => {
const d = token.onCancellationRequested(() => {
clearTimeout(handle);
stream.resolve();
d.dispose();
});
return {