提交 80e98335 编写于 作者: B Benjamin Pasero

💄

上级 187e3206
......@@ -146,13 +146,15 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
const config = configurationService.getConfiguration<IWorkbenchEditorConfiguration>();
if (config && config.workbench && config.workbench.editor) {
const editorConfig = config.workbench.editor;
this.tabOptions = {
previewEditors: editorConfig.enablePreview,
showIcons: editorConfig.showIcons,
showTabs: editorConfig.showTabs,
tabCloseButton: editorConfig.tabCloseButton
};
this.revealIfOpen = config.workbench.editor.revealIfOpen;
this.revealIfOpen = editorConfig.revealIfOpen;
this.telemetryService.publicLog('workbenchEditorConfiguration', editorConfig);
} else {
......@@ -162,6 +164,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
showTabs: true,
tabCloseButton: 'right'
};
this.revealIfOpen = false;
}
......@@ -202,7 +205,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
this._onTabOptionsChanged.fire(this.tabOptions);
}
this.revealIfOpen = configuration.workbench.editor.revealIfOpen;
this.revealIfOpen = editorConfig.revealIfOpen;
}
}
......@@ -1285,8 +1288,8 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
}
// Respect option to reveal an editor if it is open (not necessarily visible)
const skipReuse = (options && options.index) || arg1;
if (!skipReuse && this.revealIfOpen) {
const skipRevealIfOpen = (options && options.index) || arg1;
if (!skipRevealIfOpen && this.revealIfOpen) {
const group = this.stacks.findGroup(input);
if (group) {
return this.stacks.positionOfGroup(group);
......
......@@ -944,27 +944,23 @@ export class EditorStacksModel implements IEditorStacksModel {
return this._groups.indexOf(group);
}
public findGroup(editorInput: EditorInput, activeOnly?: boolean): EditorGroup {
// prefer to check activeGroup and activeEditor first
let groupsToCheck: EditorGroup[] = [];
const activeGroup = this.activeGroup;
if (activeGroup) { groupsToCheck.push(activeGroup); }
this.groups.forEach(g => { if (g !== activeGroup) { groupsToCheck.push(g); } });
public findGroup(editor: EditorInput, activeOnly?: boolean): EditorGroup {
const groupsToCheck = (this.activeGroup ? [this.activeGroup] : []).concat(this.groups.filter(g => g !== this.activeGroup));
for (let i = 0; i < groupsToCheck.length; i++) {
let editorsToCheck: EditorInput[] = [];
const group = groupsToCheck[i];
const activeEditor = group.activeEditor;
if (activeEditor) { editorsToCheck.push(activeEditor); }
group.getEditors().forEach(e => { if (e !== activeEditor) { editorsToCheck.push(e) } });
const editorsToCheck = (group.activeEditor ? [group.activeEditor] : []).concat(group.getEditors().filter(e => e !== group.activeEditor));
for (let j = 0; j < editorsToCheck.length; j++) {
const editor = editorsToCheck[j];
if ((!activeOnly || group.isActive(editor))
&& editorInput.matches(editor)) {
const editorToCheck = editorsToCheck[j];
if ((!activeOnly || group.isActive(editorToCheck)) && editor.matches(editorToCheck)) {
return group;
}
}
}
return undefined;
return void 0;
}
public positionOfGroup(group: IEditorGroup): Position;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册