Skip to content

Commit 9e65deb

Browse files
committed
zen mode: To properly reset line numbers we need to read the configuration for each editor respecting it's uri.
fixes microsoft#78545
1 parent a7fa418 commit 9e65deb

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

src/vs/workbench/browser/layout.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import { Part } from 'vs/workbench/browser/part';
3434
import { IStatusbarService } from 'vs/platform/statusbar/common/statusbar';
3535
import { IActivityBarService } from 'vs/workbench/services/activityBar/browser/activityBarService';
3636
import { IFileService } from 'vs/platform/files/common/files';
37+
import { isCodeEditor } from 'vs/editor/browser/editorBrowser';
3738

3839
enum Settings {
3940
MENUBAR_VISIBLE = 'window.menuBarVisibility',
@@ -578,7 +579,15 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
578579
this.state.zenMode.active = !this.state.zenMode.active;
579580
this.state.zenMode.transitionDisposables.clear();
580581

581-
const setLineNumbers = (lineNumbers: any) => this.editorService.visibleTextEditorWidgets.forEach(editor => editor.updateOptions({ lineNumbers }));
582+
const setLineNumbers = (lineNumbers?: any) => this.editorService.visibleTextEditorWidgets.forEach(editor => {
583+
// To properly reset line numbers we need to read the configuration for each editor respecting it's uri.
584+
if (!lineNumbers && isCodeEditor(editor) && editor.hasModel()) {
585+
const model = editor.getModel();
586+
this.configurationService.getValue('editor.lineNumbers', { resource: model.uri });
587+
} else {
588+
editor.updateOptions({ lineNumbers });
589+
}
590+
});
582591

583592
// Check if zen mode transitioned to full screen and if now we are out of zen mode
584593
// -> 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
641650
this.centerEditorLayout(false, true);
642651
}
643652

644-
setLineNumbers(this.configurationService.getValue('editor.lineNumbers'));
653+
setLineNumbers();
645654

646655
// Status bar and activity bar visibility come from settings -> update their visibility.
647656
this.doUpdateLayoutConfiguration(true);

0 commit comments

Comments
 (0)