Skip to content

Commit 8ab2e97

Browse files
authored
ExplorerViewlet triggers two layouts on load (fix microsoft#164188) (microsoft#181633)
1 parent cabc27e commit 8ab2e97

File tree

3 files changed

+4
-24
lines changed

3 files changed

+4
-24
lines changed

src/vs/workbench/contrib/files/browser/explorerViewlet.ts

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
import 'vs/css!./media/explorerviewlet';
77
import { localize } from 'vs/nls';
88
import { mark } from 'vs/base/common/performance';
9-
import { VIEWLET_ID, OpenEditorsVisibleContext, VIEW_ID, IFilesConfiguration, ExplorerViewletVisibleContext } from 'vs/workbench/contrib/files/common/files';
9+
import { VIEWLET_ID, VIEW_ID, IFilesConfiguration, ExplorerViewletVisibleContext } from 'vs/workbench/contrib/files/common/files';
1010
import { IViewletViewOptions } from 'vs/workbench/browser/parts/views/viewsViewlet';
11-
import { IConfigurationService, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration';
11+
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
1212
import { ExplorerView } from 'vs/workbench/contrib/files/browser/views/explorerView';
1313
import { EmptyView } from 'vs/workbench/contrib/files/browser/views/emptyView';
1414
import { OpenEditorsView } from 'vs/workbench/contrib/files/browser/views/openEditorsView';
@@ -43,25 +43,17 @@ const openEditorsViewIcon = registerIcon('open-editors-view-icon', Codicon.book,
4343

4444
export class ExplorerViewletViewsContribution extends Disposable implements IWorkbenchContribution {
4545

46-
private openEditorsVisibleContextKey!: IContextKey<boolean>;
47-
4846
constructor(
4947
@IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService,
50-
@IConfigurationService private readonly configurationService: IConfigurationService,
51-
@IContextKeyService contextKeyService: IContextKeyService,
5248
@IProgressService progressService: IProgressService
5349
) {
5450
super();
5551

5652
progressService.withProgress({ location: ProgressLocation.Explorer }, () => workspaceContextService.getCompleteWorkspace()).finally(() => {
5753
this.registerViews();
5854

59-
this.openEditorsVisibleContextKey = OpenEditorsVisibleContext.bindTo(contextKeyService);
60-
this.updateOpenEditorsVisibility();
61-
6255
this._register(workspaceContextService.onDidChangeWorkbenchState(() => this.registerViews()));
6356
this._register(workspaceContextService.onDidChangeWorkspaceFolders(() => this.registerViews()));
64-
this._register(this.configurationService.onDidChangeConfiguration(e => this.onConfigurationUpdated(e)));
6557
});
6658
}
6759

@@ -116,7 +108,6 @@ export class ExplorerViewletViewsContribution extends Disposable implements IWor
116108
ctorDescriptor: new SyncDescriptor(OpenEditorsView),
117109
containerIcon: openEditorsViewIcon,
118110
order: 0,
119-
when: OpenEditorsVisibleContext,
120111
canToggleVisibility: true,
121112
canMoveView: true,
122113
collapsed: false,
@@ -156,16 +147,6 @@ export class ExplorerViewletViewsContribution extends Disposable implements IWor
156147
}
157148
};
158149
}
159-
160-
private onConfigurationUpdated(e: IConfigurationChangeEvent): void {
161-
if (e.affectsConfiguration('explorer.openEditors.visible')) {
162-
this.updateOpenEditorsVisibility();
163-
}
164-
}
165-
166-
private updateOpenEditorsVisibility(): void {
167-
this.openEditorsVisibleContextKey.set(this.workspaceContextService.getWorkbenchState() === WorkbenchState.EMPTY || this.configurationService.getValue('explorer.openEditors.visible') !== 0);
168-
}
169150
}
170151

171152
export class ExplorerViewPaneContainer extends ViewPaneContainer {

src/vs/workbench/contrib/files/browser/files.contribution.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,9 +345,9 @@ configurationRegistry.registerConfiguration({
345345
'properties': {
346346
'explorer.openEditors.visible': {
347347
'type': 'number',
348-
'description': nls.localize({ key: 'openEditorsVisible', comment: ['Open is an adjective'] }, "The initial maximum number of editors shown in the Open Editors pane. Exceeding this limit will show a scroll bar and allow resizing the pane to display more items. Setting this to 0 hides the Open Editors pane."),
348+
'description': nls.localize({ key: 'openEditorsVisible', comment: ['Open is an adjective'] }, "The initial maximum number of editors shown in the Open Editors pane. Exceeding this limit will show a scroll bar and allow resizing the pane to display more items."),
349349
'default': 9,
350-
'minimum': 0
350+
'minimum': 1
351351
},
352352
'explorer.openEditors.minVisible': {
353353
'type': 'number',

src/vs/workbench/contrib/files/common/files.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ export const ExplorerRootContext = new RawContextKey<boolean>('explorerResourceI
4949
export const ExplorerResourceCut = new RawContextKey<boolean>('explorerResourceCut', false, { type: 'boolean', description: localize('explorerResourceCut', "True when an item in the EXPLORER has been cut for cut and paste.") });
5050
export const ExplorerResourceMoveableToTrash = new RawContextKey<boolean>('explorerResourceMoveableToTrash', false, { type: 'boolean', description: localize('explorerResourceMoveableToTrash', "True when the focused item in the EXPLORER can be moved to trash.") });
5151
export const FilesExplorerFocusedContext = new RawContextKey<boolean>('filesExplorerFocus', true, { type: 'boolean', description: localize('filesExplorerFocus', "True when the focus is inside the EXPLORER view.") });
52-
export const OpenEditorsVisibleContext = new RawContextKey<boolean>('openEditorsVisible', false, { type: 'boolean', description: localize('openEditorsVisible', "True when the OPEN EDITORS view is visible.") });
5352
export const OpenEditorsFocusedContext = new RawContextKey<boolean>('openEditorsFocus', true, { type: 'boolean', description: localize('openEditorsFocus', "True when the focus is inside the OPEN EDITORS view.") });
5453
export const ExplorerFocusedContext = new RawContextKey<boolean>('explorerViewletFocus', true, { type: 'boolean', description: localize('explorerViewletFocus', "True when the focus is inside the EXPLORER viewlet.") });
5554

0 commit comments

Comments
 (0)