diff --git a/src/vs/workbench/browser/parts/editor/editorPart.ts b/src/vs/workbench/browser/parts/editor/editorPart.ts index 0899f3bd851695edc939ce98fe18a589ddabe15d..fead4e1c3b3cb66b3b2782c79b02757f811d2a52 100644 --- a/src/vs/workbench/browser/parts/editor/editorPart.ts +++ b/src/vs/workbench/browser/parts/editor/editorPart.ts @@ -25,7 +25,7 @@ import { EditorInput, EditorOptions, ConfirmResult, IWorkbenchEditorConfiguratio import { EditorGroupsControl, Rochade, IEditorGroupsControl, ProgressState } from 'vs/workbench/browser/parts/editor/editorGroupsControl'; import { WorkbenchProgressService } from 'vs/workbench/services/progress/browser/progressService'; import { IEditorGroupService, GroupOrientation, GroupArrangement, IEditorTabOptions, IMoveOptions } from 'vs/workbench/services/group/common/groupService'; -import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; +import { IConfigurationService, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration'; import { IEditorPart } from 'vs/workbench/services/editor/common/editorService'; import { IPartService } from 'vs/workbench/services/part/common/partService'; import { Position, POSITIONS, Direction, IEditor } from 'vs/platform/editor/common/editor'; @@ -205,41 +205,45 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService this.toUnbind.push(this.stacks.onEditorClosed(event => this.onEditorClosed(event))); this.toUnbind.push(this.stacks.onGroupOpened(event => this.onEditorGroupOpenedOrClosed())); this.toUnbind.push(this.stacks.onGroupClosed(event => this.onEditorGroupOpenedOrClosed())); - this.toUnbind.push(this.configurationService.onDidChangeConfiguration(e => this.onConfigurationUpdated(this.configurationService.getConfiguration()))); + this.toUnbind.push(this.configurationService.onDidChangeConfiguration(e => this.onConfigurationUpdated(e))); } private onEditorGroupOpenedOrClosed(): void { this.updateStyles(); } - private onConfigurationUpdated(configuration: IWorkbenchEditorConfiguration): void { - if (configuration && configuration.workbench && configuration.workbench.editor) { - const editorConfig = configuration.workbench.editor; + private onConfigurationUpdated(event: IConfigurationChangeEvent): void { + if (event.affectsConfiguration('workbench.editor')) { + const configuration = this.configurationService.getConfiguration(); + if (configuration && configuration.workbench && configuration.workbench.editor) { + const editorConfig = configuration.workbench.editor; - // Pin all preview editors of the user chose to disable preview - const newPreviewEditors = editorConfig.enablePreview; - if (this.tabOptions.previewEditors !== newPreviewEditors && !newPreviewEditors) { - this.stacks.groups.forEach(group => { - if (group.previewEditor) { - this.pinEditor(group, group.previewEditor); - } - }); - } - const oldTabOptions = objects.clone(this.tabOptions); - this.tabOptions = { - previewEditors: newPreviewEditors, - showIcons: editorConfig.showIcons, - tabCloseButton: editorConfig.tabCloseButton, - showTabs: this.forceHideTabs ? false : editorConfig.showTabs, - labelFormat: editorConfig.labelFormat, - }; + // Pin all preview editors of the user chose to disable preview + const newPreviewEditors = editorConfig.enablePreview; + if (this.tabOptions.previewEditors !== newPreviewEditors && !newPreviewEditors) { + this.stacks.groups.forEach(group => { + if (group.previewEditor) { + this.pinEditor(group, group.previewEditor); + } + }); + } - if (!this.doNotFireTabOptionsChanged && !objects.equals(oldTabOptions, this.tabOptions)) { - this._onTabOptionsChanged.fire(this.tabOptions); - } + const oldTabOptions = objects.clone(this.tabOptions); + this.tabOptions = { + previewEditors: newPreviewEditors, + showIcons: editorConfig.showIcons, + tabCloseButton: editorConfig.tabCloseButton, + showTabs: this.forceHideTabs ? false : editorConfig.showTabs, + labelFormat: editorConfig.labelFormat, + }; + + if (!this.doNotFireTabOptionsChanged && !objects.equals(oldTabOptions, this.tabOptions)) { + this._onTabOptionsChanged.fire(this.tabOptions); + } - this.revealIfOpen = editorConfig.revealIfOpen; + this.revealIfOpen = editorConfig.revealIfOpen; + } } }