From d66d3dd7a0893bf17aa64f2ca8b9b28949e3f702 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Mon, 25 Jun 2018 11:29:16 -0700 Subject: [PATCH] Fix #52809 - add setting to hide TOC entirely --- .../electron-browser/main.contribution.ts | 7 ++++++- .../preferences/browser/media/settingsEditor2.css | 5 +++-- .../parts/preferences/browser/settingsEditor2.ts | 15 ++++++++++++++- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/electron-browser/main.contribution.ts b/src/vs/workbench/electron-browser/main.contribution.ts index b5b9b6e9ba1..12a7cafd10f 100644 --- a/src/vs/workbench/electron-browser/main.contribution.ts +++ b/src/vs/workbench/electron-browser/main.contribution.ts @@ -310,8 +310,13 @@ configurationRegistry.registerConfiguration({ 'workbench.settings.settingsSearchTocBehavior': { 'type': 'string', 'enum': ['hide', 'filter', 'show'], - 'description': nls.localize('settingsSearchTocBehavior', "Controls the behavior of the settings editor TOC while searching."), + 'description': nls.localize('settingsSearchTocBehavior', "Controls the behavior of the settings editor Table of Contents while searching."), 'default': 'hide' + }, + 'workbench.settings.tocVisible': { + 'type': 'boolean', + 'description': nls.localize('settingsTocVisible', "Controls whether the settings editor Table of Contents is visible."), + 'default': true } } }); diff --git a/src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css b/src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css index 9b08dd0e458..ac698aadab9 100644 --- a/src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css +++ b/src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css @@ -111,10 +111,11 @@ .settings-editor > .settings-body .settings-toc-container { width: 175px; margin-right: 5px; + padding-top: 5px; } -.settings-editor > .settings-body .settings-toc-container { - padding-top: 5px; +.settings-editor > .settings-body .settings-toc-container.hidden { + display: none; } .search-mode .settings-toc-container { diff --git a/src/vs/workbench/parts/preferences/browser/settingsEditor2.ts b/src/vs/workbench/parts/preferences/browser/settingsEditor2.ts index 77dbe5331ab..a850561da36 100644 --- a/src/vs/workbench/parts/preferences/browser/settingsEditor2.ts +++ b/src/vs/workbench/parts/preferences/browser/settingsEditor2.ts @@ -99,7 +99,13 @@ export class SettingsEditor2 extends BaseEditor { this.inSettingsEditorContextKey = CONTEXT_SETTINGS_EDITOR.bindTo(contextKeyService); this.searchFocusContextKey = CONTEXT_SETTINGS_SEARCH_FOCUS.bindTo(contextKeyService); - this._register(configurationService.onDidChangeConfiguration(() => this.onConfigUpdate())); + this._register(configurationService.onDidChangeConfiguration(e => { + this.onConfigUpdate(); + + if (e.affectsConfiguration('workbench.settings.tocVisible')) { + this.updateTOCVisible(); + } + })); } createEditor(parent: HTMLElement): void { @@ -259,6 +265,13 @@ export class SettingsEditor2 extends BaseEditor { } } })); + + this.updateTOCVisible(); + } + + private updateTOCVisible(): void { + const visible = !!this.configurationService.getValue('workbench.settings.tocVisible'); + DOM.toggleClass(this.tocTreeContainer, 'hidden', !visible); } private createSettingsTree(parent: HTMLElement): void { -- GitLab