提交 5988be98 编写于 作者: I isidor

explorer.openEditors.maxVisible -> explorer.openEditors.visible

#6919
上级 baa7ece9
...@@ -61,7 +61,7 @@ export class ExplorerViewlet extends Viewlet { ...@@ -61,7 +61,7 @@ export class ExplorerViewlet extends Viewlet {
return this.configurationService.loadConfiguration().then((config:IFilesConfiguration) => { return this.configurationService.loadConfiguration().then((config:IFilesConfiguration) => {
// Open editors view should always be visible in no folder workspace. // Open editors view should always be visible in no folder workspace.
this.openEditorsVisible = !this.contextService.getWorkspace() || config.explorer.openEditors.maxVisible !== 0; this.openEditorsVisible = !this.contextService.getWorkspace() || config.explorer.openEditors.visible !== 0;
if (this.openEditorsVisible) { if (this.openEditorsVisible) {
this.splitView = new SplitView(this.viewletContainer.getHTMLElement()); this.splitView = new SplitView(this.viewletContainer.getHTMLElement());
......
...@@ -238,9 +238,9 @@ configurationRegistry.registerConfiguration({ ...@@ -238,9 +238,9 @@ configurationRegistry.registerConfiguration({
'title': nls.localize('explorerConfigurationTitle', "File Explorer configuration"), 'title': nls.localize('explorerConfigurationTitle', "File Explorer configuration"),
'type': 'object', 'type': 'object',
'properties': { 'properties': {
'explorer.openEditors.maxVisible': { 'explorer.openEditors.visible': {
'type': 'number', 'type': 'number',
'description': nls.localize('maxVisible', "Maximum number of open editors to show before scrollbars appear. If set to 0 open editors section gets hidden - only applied after VSCode restart."), 'description': nls.localize('openEditorsVisible', "Number of editors shown in the Open Editors pane. Set it to 0 to hide the pane."),
'default': 9 'default': 9
}, },
'explorer.openEditors.dynamicHeight': { 'explorer.openEditors.dynamicHeight': {
......
...@@ -31,11 +31,11 @@ const $ = dom.emmet; ...@@ -31,11 +31,11 @@ const $ = dom.emmet;
export class OpenEditorsView extends AdaptiveCollapsibleViewletView { export class OpenEditorsView extends AdaptiveCollapsibleViewletView {
private static MEMENTO_COLLAPSED = 'openEditors.memento.collapsed'; private static MEMENTO_COLLAPSED = 'openEditors.memento.collapsed';
private static DEFAULT_MAX_VISIBLE_OPEN_EDITORS = 9; private static DEFAULT_VISIBLE_OPEN_EDITORS = 9;
private static DEFAULT_DYNAMIC_HEIGHT = true; private static DEFAULT_DYNAMIC_HEIGHT = true;
private settings: any; private settings: any;
private maxVisibleOpenEditors: number; private visibleOpenEditors: number;
private dynamicHeight: boolean; private dynamicHeight: boolean;
private model: IEditorStacksModel; private model: IEditorStacksModel;
...@@ -178,11 +178,11 @@ export class OpenEditorsView extends AdaptiveCollapsibleViewletView { ...@@ -178,11 +178,11 @@ export class OpenEditorsView extends AdaptiveCollapsibleViewletView {
} }
private onConfigurationUpdated(configuration: IFilesConfiguration): void { private onConfigurationUpdated(configuration: IFilesConfiguration): void {
let visibleOpenEditors = configuration && configuration.explorer && configuration.explorer.openEditors && configuration.explorer.openEditors.maxVisible; let visibleOpenEditors = configuration && configuration.explorer && configuration.explorer.openEditors && configuration.explorer.openEditors.visible;
if (typeof visibleOpenEditors === 'number') { if (typeof visibleOpenEditors === 'number') {
this.maxVisibleOpenEditors = visibleOpenEditors; this.visibleOpenEditors = visibleOpenEditors;
} else { } else {
this.maxVisibleOpenEditors = OpenEditorsView.DEFAULT_MAX_VISIBLE_OPEN_EDITORS; this.visibleOpenEditors = OpenEditorsView.DEFAULT_VISIBLE_OPEN_EDITORS;
} }
let dynamicHeight = configuration && configuration.explorer && configuration.explorer.openEditors && configuration.explorer.openEditors.dynamicHeight; let dynamicHeight = configuration && configuration.explorer && configuration.explorer.openEditors && configuration.explorer.openEditors.dynamicHeight;
...@@ -241,17 +241,17 @@ export class OpenEditorsView extends AdaptiveCollapsibleViewletView { ...@@ -241,17 +241,17 @@ export class OpenEditorsView extends AdaptiveCollapsibleViewletView {
} }
private getExpandedBodySize(model: IEditorStacksModel): number { private getExpandedBodySize(model: IEditorStacksModel): number {
return OpenEditorsView.computeExpandedBodySize(model, this.maxVisibleOpenEditors, this.dynamicHeight); return OpenEditorsView.computeExpandedBodySize(model, this.visibleOpenEditors, this.dynamicHeight);
} }
private static computeExpandedBodySize(model: IEditorStacksModel, maxVisibleOpenEditors = OpenEditorsView.DEFAULT_MAX_VISIBLE_OPEN_EDITORS, dynamicHeight = OpenEditorsView.DEFAULT_DYNAMIC_HEIGHT): number { private static computeExpandedBodySize(model: IEditorStacksModel, visibleOpenEditors = OpenEditorsView.DEFAULT_VISIBLE_OPEN_EDITORS, dynamicHeight = OpenEditorsView.DEFAULT_DYNAMIC_HEIGHT): number {
const entryCount = model.groups.reduce((sum, group) => sum + group.count, 0); const entryCount = model.groups.reduce((sum, group) => sum + group.count, 0);
let itemsToShow: number; let itemsToShow: number;
if (dynamicHeight) { if (dynamicHeight) {
itemsToShow = Math.min(Math.max(maxVisibleOpenEditors, 1), entryCount); itemsToShow = Math.min(Math.max(visibleOpenEditors, 1), entryCount);
} else { } else {
itemsToShow = Math.max(maxVisibleOpenEditors, 1); itemsToShow = Math.max(visibleOpenEditors, 1);
} }
// We only show the group labels if there is more than 1 group // We only show the group labels if there is more than 1 group
if (model.groups.length > 1) { if (model.groups.length > 1) {
......
...@@ -60,7 +60,7 @@ export abstract class FileEditorInput extends EditorInput implements IFileEditor ...@@ -60,7 +60,7 @@ export abstract class FileEditorInput extends EditorInput implements IFileEditor
export interface IFilesConfiguration extends IFilesConfiguration { export interface IFilesConfiguration extends IFilesConfiguration {
explorer: { explorer: {
openEditors: { openEditors: {
maxVisible: number; visible: number;
dynamicHeight: boolean; dynamicHeight: boolean;
}; };
autoReveal: boolean; autoReveal: boolean;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册