This commit is contained in:
Alex Dima
2020-10-06 22:18:15 +02:00
parent 2d6d4a328a
commit 443508c4c9
9 changed files with 87 additions and 29 deletions

View File

@@ -977,4 +977,42 @@ suite('vscode API - workspace', () => {
// const expected2 = 'import2;import1;';
assert.equal(document.getText(), expected);
});
test('issue #107739 - Redo of rename Java Class name has no effect', async () => {
const file = await createRandomFile('hello');
const fileName = basename(file.fsPath);
const newFile = vscode.Uri.parse(file.toString().replace(fileName, `${fileName}2`));
// apply edit
{
const we = new vscode.WorkspaceEdit();
we.insert(file, new vscode.Position(0, 5), '2');
we.renameFile(file, newFile);
await vscode.workspace.applyEdit(we);
}
// show the new document
{
const document = await vscode.workspace.openTextDocument(newFile);
await vscode.window.showTextDocument(document);
assert.equal(document.getText(), 'hello2');
}
// undo and show the old document
{
await vscode.commands.executeCommand('undo');
const document = await vscode.workspace.openTextDocument(file);
await vscode.window.showTextDocument(document);
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');
// }
});
});