editors - return undefined from openEditor when operation cancelled (fix #134786)

This commit is contained in:
Benjamin Pasero
2021-10-28 09:23:08 +02:00
parent 98b67faef4
commit 6ed67dd61e
4 changed files with 105 additions and 33 deletions

View File

@@ -190,6 +190,29 @@ suite('vscode API - window', () => {
}
});
test.only('editor, opening multiple at the same time #134786', async () => {
const fileA = await createRandomFile();
const fileB = await createRandomFile();
const fileC = await createRandomFile();
const testFiles = [fileA, fileB, fileC];
const result = await Promise.all(testFiles.map(async testFile => {
try {
const doc = await workspace.openTextDocument(testFile);
const editor = await window.showTextDocument(doc);
return editor.document.uri;
} catch (error) {
return undefined;
}
}));
assert.strictEqual(result.length, 3);
assert.strictEqual(result[0], undefined);
assert.strictEqual(result[1], undefined);
assert.strictEqual(result[2]?.toString(), fileC.toString());
});
test('default column when opening a file', async () => {
const [docA, docB, docC] = await Promise.all([
workspace.openTextDocument(await createRandomFile()),