Locked groups: inactive tab not revealed in locked group (fix #131520)

This commit is contained in:
Benjamin Pasero
2021-08-26 09:08:48 +02:00
parent 970b294482
commit a577d545f1
2 changed files with 13 additions and 4 deletions

View File

@@ -163,10 +163,10 @@ function isGroupLockedForEditor(group: IEditorGroup, editor: IEditorInput | IUnt
return false;
}
if (isActive(group, editor)) {
// special case: the active editor of the locked group
// matches the provided one, so in that case we do not
// want to open the editor in any different group.
if (isOpened(group, editor)) {
// special case: the locked group contains
// the provided editor. in that case we do not want
// to open the editor in any different group.
return false;
}

View File

@@ -199,6 +199,7 @@ suite('EditorService', () => {
let input4: IResourceEditorInput = { resource: URI.parse('file://resource4-basics.editor-service-locked-group-tests'), options: { pinned: true } };
let input5: IResourceEditorInput = { resource: URI.parse('file://resource5-basics.editor-service-locked-group-tests'), options: { pinned: true } };
let input6: IResourceEditorInput = { resource: URI.parse('file://resource6-basics.editor-service-locked-group-tests'), options: { pinned: true } };
let input7: IResourceEditorInput = { resource: URI.parse('file://resource7-basics.editor-service-locked-group-tests'), options: { pinned: true } };
let editor1 = await service.openEditor(input1, { pinned: true });
let editor2 = await service.openEditor(input2, { pinned: true }, SIDE_GROUP);
@@ -301,6 +302,14 @@ suite('EditorService', () => {
assert.strictEqual(part.count, 4);
assert.strictEqual(part.activeGroup, group3);
assert.strictEqual(group3.activeEditor?.resource?.toString(), input6.resource.toString());
// Will reveal an opened editor in the active locked group
await service.openEditor(input7, { pinned: true }, group3);
await service.openEditor(input6, { pinned: true });
assert.strictEqual(part.count, 4);
assert.strictEqual(part.activeGroup, group3);
assert.strictEqual(group3.activeEditor?.resource?.toString(), input6.resource.toString());
});
test('locked groups - workbench.editor.revealIfOpen', async () => {