Finalize test for #107739

This commit is contained in:
Alex Dima 2020-10-06 22:45:46 +02:00
parent 443508c4c9
commit ca01c69720
No known key found for this signature in database
GPG Key ID: 6E58D7B045760DA0
2 changed files with 12 additions and 15 deletions

View File

@ -1006,13 +1006,13 @@ suite('vscode API - workspace', () => {
assert.equal(document.getText(), 'hello');
}
// // redo and show the new document
// {
// await vscode.commands.executeCommand('redo');
// const document = await vscode.workspace.openTextDocument(newFile);
// await vscode.window.showTextDocument(document);
// assert.equal(document.getText(), 'hello2');
// }
// redo and show the new document
{
await vscode.commands.executeCommand('redo');
const document = await vscode.workspace.openTextDocument(newFile);
await vscode.window.showTextDocument(document);
assert.equal(document.getText(), 'hello2');
}
});
});

View File

@ -741,27 +741,24 @@ export class UndoRedoService implements IUndoRedoService {
return result;
}
private _invokeResourcePrepare(element: ResourceStackElement, callback: (disposable: IDisposable) => void): void | Promise<void> {
private _invokeResourcePrepare(element: ResourceStackElement, callback: (disposable: IDisposable) => Promise<void> | void): void | Promise<void> {
if (element.actual.type !== UndoRedoElementType.Workspace || typeof element.actual.prepareUndoRedo === 'undefined') {
// no preparation needed
callback(Disposable.None);
return;
return callback(Disposable.None);
}
const r = element.actual.prepareUndoRedo();
if (!r) {
// nothing to clean up
callback(Disposable.None);
return;
return callback(Disposable.None);
}
if (isDisposable(r)) {
callback(r);
return;
return callback(r);
}
return r.then((disposable) => {
callback(disposable);
return callback(disposable);
});
}