Change:
<!-- Please read our Rules of Conduct: --<!-- Please search existing issues to avoid creating duplicates. --<!-- Also please test using the latest insiders build to make sure your issue has not already been fixed: --<!-- Use Help Report Issue to prefill these. --- VSCode Version: 1.41.1 (user setup) OS Version: Windows_NT x64 10.0. Steps to Reproduce: you have at least one file open in editor Zen Mode on a file in the Source Control tab under the CHANGES sub-heading to open the side-by-side diff Zen Mode on the tab for the file opened in step 1 & observe the area where line numbers should appear ! <!-- Launch with to check. --Does this issue occur when all extensions are disabled?: Yes
(Experimental duplicate detection) Thanks for submitting this issue. Please also check if it is already covered by an existing one, like: <!-- score: 0.648 --- <!-- score: 0.605 --- <!-- score: 0.58 --- <!-- score: 0.523 --- <!-- score: 0.522 --<!-- potentialduplicatescomment --
I acknowledge this issue. The problem is how we reset the line numbers after exiting zen mode Code pointer An elegant PR that fixes this is welcome. We might also look into this in the future.
I took a look at this and to fix this we need not just the but the non-visible ones too. I looked around and it seems there is no method for this in or There is an array in that holds the visible and non-visible editors, would it be fine to expose this variable ?
thanks for looking into this. That sounds reasonable. However let's check with if he wants to expose non visible editors in the or if he has a better suggestion for this. Alternative would be to remember all the editors that we have hidden line numbers for, and then when bringing them back to go through those editors.
gives access to all opened editors.
Ok thanks. so that + should probably give you all the .
gives an array of which doesn't have a method. Is there a way to get a from an ?
I believe the Editor control only exists for the visible editors (thus we create just one editor per Group). To save on resources. So I believe the correct way to fix this is to remember all the editors that we have hidden line numbers for, and then when bringing them back to go through those editors. can correct me if I am wrong. Thansk
Yes, for performance reasons we only allocate 1 editor control per visible tab, not for each tab that is hidden.
I pushed 2 branches with different fixes for this issue This branch fixes it by using a to remember all the editor we have hidden line numbers as isidorn suggested. Not sure if it's safe to call on disposed editor widgets (this could happen if we have multiple editor groups and we close any of them) This branch fixes it by exposing the array in and updating the and interfaces let me know which approach is preferred to create the corresponding PR
let's go with approach 1. Once you create the PR i can further comment on it. Thanks a lot!
Thanks for fixing this

Discussion:
import { LifecyclePhase, StartupKind, ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle'; import { MenuBarVisibility, getTitleBarStyle, getMenuBarVisibility } from 'vs/platform/windows/common/windows'; import { IHostService } from 'vs/workbench/services/host/browser/host'; <ins> import { IEditor } from 'vs/editor/common/editorCommon'; </ins> import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { IEditorService, IResourceEditor } from 'vs/workbench/services/editor/common/editorService'; import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';

private workbenchGrid!: SerializableGrid<ISerializableView>; <ins> private editorWidgetSet = new Set<IEditor>(); </ins> private disposed: boolean | undefined; private titleBarPartView!: ISerializableView;

this.state.zenMode.active = !this.state.zenMode.active; this.state.zenMode.transitionDisposables.clear(); <del> 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(); lineNumbers = this.configurationService.getValue('editor.lineNumbers', { resource: model.uri, overrideIdentifier: model.getModeId() }); } </del> <ins> const setLineNumbers = (lineNumbers?: any) => { const setEditorLineNumbers = (editor: IEditor) => { // 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(); lineNumbers = this.configurationService.getValue('editor.lineNumbers', { resource: model.uri, overrideIdentifier: model.getModeId() }); } if (!lineNumbers) { lineNumbers = this.configurationService.getValue('editor.lineNumbers'); } editor.updateOptions({ lineNumbers }); }; </ins> if (!lineNumbers) { <del> lineNumbers = this.configurationService.getValue('editor.lineNumbers'); </del> <ins> // Reset line numbers on all editors visible and non-visible for (const editor of this.editorWidgetSet) { setEditorLineNumbers(editor); } this.editorWidgetSet.clear(); } else { this.editorService.visibleTextEditorWidgets.forEach(editor => { this.editorWidgetSet.add(editor); setEditorLineNumbers(editor); }); </ins> } <del> editor.updateOptions({ lineNumbers }); }); </del> <ins> }; </ins> // 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)