mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-21 17:19:01 +01:00
Add test for #107739
This commit is contained in:
@@ -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');
|
||||
// }
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user