diff --git a/src/vs/workbench/electron-browser/main.contribution.ts b/src/vs/workbench/electron-browser/main.contribution.ts index 458497b4f46..7a13bd59574 100644 --- a/src/vs/workbench/electron-browser/main.contribution.ts +++ b/src/vs/workbench/electron-browser/main.contribution.ts @@ -886,6 +886,11 @@ configurationRegistry.registerConfiguration({ 'default': true, 'description': nls.localize('zenMode.hideActivityBar', "Controls whether turning on Zen Mode also hides the activity bar at the left of the workbench.") }, + 'zenMode.hideLineNumbers': { + 'type': 'boolean', + 'default': true, + 'description': nls.localize('zenMode.hideLineNumbers', "Controls whether turning on Zen Mode also hides the editor line numbers.") + }, 'zenMode.restore': { 'type': 'boolean', 'default': false, diff --git a/src/vs/workbench/electron-browser/workbench.ts b/src/vs/workbench/electron-browser/workbench.ts index e7eea355c12..e69e99c189b 100644 --- a/src/vs/workbench/electron-browser/workbench.ts +++ b/src/vs/workbench/electron-browser/workbench.ts @@ -113,6 +113,7 @@ import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/work import { IFileDialogService } from 'vs/platform/dialogs/common/dialogs'; import { FileDialogService } from 'vs/workbench/services/dialogs/electron-browser/dialogService'; import { LogStorageAction } from 'vs/platform/storage/node/storageService'; +import { IEditor } from 'vs/editor/common/editorCommon'; interface WorkbenchParams { configuration: IWindowConfiguration; @@ -125,6 +126,7 @@ interface IZenModeSettings { hideTabs: boolean; hideActivityBar: boolean; hideStatusBar: boolean; + hideLineNumbers: boolean; restore: boolean; } @@ -1236,6 +1238,14 @@ export class Workbench extends Disposable implements IPartService { // Check if zen mode transitioned to full screen and if now we are out of zen mode // -> we need to go out of full screen (same goes for the centered editor layout) let toggleFullScreen = false; + const setLineNumbers = (lineNumbers: any) => { + this.editorService.visibleControls.forEach(editor => { + const control = editor.getControl(); + if (control) { + control.updateOptions({ lineNumbers }); + } + }); + }; // Zen Mode Active if (this.zenMode.active) { @@ -1258,6 +1268,11 @@ export class Workbench extends Disposable implements IPartService { this.setStatusBarHidden(true, true); } + if (config.hideLineNumbers) { + setLineNumbers('off'); + this.zenMode.transitionDisposeables.push(this.editorService.onDidVisibleEditorsChange(() => setLineNumbers('off'))); + } + if (config.hideTabs && this.editorPart.partOptions.showTabs) { this.zenMode.transitionDisposeables.push(this.editorPart.enforcePartOptions({ showTabs: false })); } @@ -1280,6 +1295,7 @@ export class Workbench extends Disposable implements IPartService { if (this.zenMode.transitionedToCenteredEditorLayout) { this.centerEditorLayout(false, true); } + setLineNumbers(this.configurationService.getValue('editor.lineNumbers')); // Status bar and activity bar visibility come from settings -> update their visibility. this.onDidUpdateConfiguration(true);