Skip to content

Commit 35355ac

Browse files
lramos15aeschli
authored andcommitted
Add minimum visible count to open editors (#147771)
1 parent 87687ce commit 35355ac

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,10 +337,16 @@ configurationRegistry.registerConfiguration({
337337
'properties': {
338338
'explorer.openEditors.visible': {
339339
'type': 'number',
340-
'description': nls.localize({ key: 'openEditorsVisible', comment: ['Open is an adjective'] }, "Number of editors shown in the Open Editors pane. Setting this to 0 hides the Open Editors pane."),
340+
'description': nls.localize({ key: 'openEditorsVisible', comment: ['Open is an adjective'] }, "The maximum number of editors shown in the Open Editors pane. Setting this to 0 hides the Open Editors pane."),
341341
'default': 9,
342342
'minimum': 0
343343
},
344+
'explorer.openEditors.minVisible': {
345+
'type': 'number',
346+
'description': nls.localize({ key: 'openEditorsVisibleMin', comment: ['Open is an adjective'] }, "The minimum number of editor slots shown in the Open Editors pane. If set to 0 the Open Editors pane will dynamically resize based on the number of editors."),
347+
'default': 0,
348+
'minimum': 0
349+
},
344350
'explorer.openEditors.sortOrder': {
345351
'type': 'string',
346352
'enum': ['editorOrder', 'alphabetical', 'fullPath'],

src/vs/workbench/contrib/files/browser/views/openEditorsView.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ const $ = dom.$;
5959
export class OpenEditorsView extends ViewPane {
6060

6161
private static readonly DEFAULT_VISIBLE_OPEN_EDITORS = 9;
62+
private static readonly DEFAULT_MIN_VISIBLE_OPEN_EDITORS = 0;
6263
static readonly ID = 'workbench.explorer.openEditorsView';
6364
static readonly NAME = nls.localize({ key: 'openEditors', comment: ['Open is an adjective'] }, "Open Editors");
6465

@@ -466,12 +467,17 @@ export class OpenEditorsView extends ViewPane {
466467
}
467468

468469
private getMaxExpandedBodySize(): number {
470+
let minVisibleOpenEditors = this.configurationService.getValue<number>('explorer.openEditors.minVisible');
471+
// If it's not a number setting it to 0 will result in dynamic resizing.
472+
if (typeof minVisibleOpenEditors !== 'number') {
473+
minVisibleOpenEditors = OpenEditorsView.DEFAULT_MIN_VISIBLE_OPEN_EDITORS;
474+
}
469475
const containerModel = this.viewDescriptorService.getViewContainerModel(this.viewDescriptorService.getViewContainerByViewId(this.id)!)!;
470476
if (containerModel.visibleViewDescriptors.length <= 1) {
471477
return Number.POSITIVE_INFINITY;
472478
}
473479

474-
return this.elementCount * OpenEditorsDelegate.ITEM_HEIGHT;
480+
return (Math.max(this.elementCount, minVisibleOpenEditors)) * OpenEditorsDelegate.ITEM_HEIGHT;
475481
}
476482

477483
private getMinExpandedBodySize(): number {

0 commit comments

Comments
 (0)