From 9e65debe363ac10ae1a383eb885a6a2dbff16d06 Mon Sep 17 00:00:00 2001 From: isidor Date: Wed, 7 Aug 2019 10:58:42 +0200 Subject: [PATCH] zen mode: To properly reset line numbers we need to read the configuration for each editor respecting it's uri. fixes #78545 --- src/vs/workbench/browser/layout.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/browser/layout.ts b/src/vs/workbench/browser/layout.ts index 9ddefc89b44..89d9dca6b46 100644 --- a/src/vs/workbench/browser/layout.ts +++ b/src/vs/workbench/browser/layout.ts @@ -34,6 +34,7 @@ import { Part } from 'vs/workbench/browser/part'; import { IStatusbarService } from 'vs/platform/statusbar/common/statusbar'; import { IActivityBarService } from 'vs/workbench/services/activityBar/browser/activityBarService'; import { IFileService } from 'vs/platform/files/common/files'; +import { isCodeEditor } from 'vs/editor/browser/editorBrowser'; enum Settings { MENUBAR_VISIBLE = 'window.menuBarVisibility', @@ -578,7 +579,15 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi this.state.zenMode.active = !this.state.zenMode.active; this.state.zenMode.transitionDisposables.clear(); - const setLineNumbers = (lineNumbers: any) => this.editorService.visibleTextEditorWidgets.forEach(editor => editor.updateOptions({ lineNumbers })); + const setLineNumbers = (lineNumbers?: any) => this.editorService.visibleTextEditorWidgets.forEach(editor => { + // To properly reset line numbers we need to read the configuration for each editor respecting it's uri. + if (!lineNumbers && isCodeEditor(editor) && editor.hasModel()) { + const model = editor.getModel(); + this.configurationService.getValue('editor.lineNumbers', { resource: model.uri }); + } else { + editor.updateOptions({ lineNumbers }); + } + }); // 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) @@ -641,7 +650,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi this.centerEditorLayout(false, true); } - setLineNumbers(this.configurationService.getValue('editor.lineNumbers')); + setLineNumbers(); // Status bar and activity bar visibility come from settings -> update their visibility. this.doUpdateLayoutConfiguration(true); -- GitLab