Skip to content

Commit

Permalink
aux window - limit zen mode to main part for now
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasero committed Nov 17, 2023
1 parent a76b835 commit 634df63
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 15 deletions.
1 change: 1 addition & 0 deletions src/vs/workbench/browser/actions/layoutActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,7 @@ registerAction2(class extends Action2 {
mnemonicTitle: localize({ key: 'miToggleZenMode', comment: ['&& denotes a mnemonic'] }, "Zen Mode"),
original: 'Toggle Zen Mode'
},
precondition: IsAuxiliaryWindowFocusedContext.toNegated(),
category: Categories.View,
f1: true,
keybinding: {
Expand Down
9 changes: 4 additions & 5 deletions src/vs/workbench/browser/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1296,12 +1296,11 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
};

if (!lineNumbers) {
// Reset line numbers on all editors visible and non-visible
for (const editorControl of this.editorService.visibleTextEditorControls) {
for (const editorControl of this.mainPartEditorService.visibleTextEditorControls) {
setEditorLineNumbers(editorControl);
}
} else {
for (const editorControl of this.editorService.visibleTextEditorControls) {
for (const editorControl of this.mainPartEditorService.visibleTextEditorControls) {
setEditorLineNumbers(editorControl);
}
}
Expand Down Expand Up @@ -1342,11 +1341,11 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi

if (config.hideLineNumbers) {
setLineNumbers('off');
this.state.runtime.zenMode.transitionDisposables.add(this.editorService.onDidVisibleEditorsChange(() => setLineNumbers('off')));
this.state.runtime.zenMode.transitionDisposables.add(this.mainPartEditorService.onDidVisibleEditorsChange(() => setLineNumbers('off')));
}

if (config.showTabs !== this.editorGroupService.partOptions.showTabs) {
this.state.runtime.zenMode.transitionDisposables.add(this.editorGroupService.enforcePartOptions({ showTabs: config.showTabs }));
this.state.runtime.zenMode.transitionDisposables.add(this.editorGroupService.mainPart.enforcePartOptions({ showTabs: config.showTabs }));
}

if (config.silentNotifications && zenModeExitInfo.handleNotificationsDoNotDisturbMode) {
Expand Down
6 changes: 1 addition & 5 deletions src/vs/workbench/browser/parts/editor/editorParts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { EditorGroupLayout, GroupDirection, GroupOrientation, GroupsArrangement,
import { Event, Emitter } from 'vs/base/common/event';
import { getActiveDocument } from 'vs/base/browser/dom';
import { Disposable, DisposableStore, IDisposable, toDisposable } from 'vs/base/common/lifecycle';
import { GroupIdentifier, IEditorPartOptions } from 'vs/workbench/common/editor';
import { GroupIdentifier } from 'vs/workbench/common/editor';
import { AuxiliaryEditorPart, EditorPart, MainEditorPart } from 'vs/workbench/browser/parts/editor/editorPart';
import { IEditorGroupView, IEditorPartsView } from 'vs/workbench/browser/parts/editor/editor';
import { InstantiationType, registerSingleton } from 'vs/platform/instantiation/common/extensions';
Expand Down Expand Up @@ -348,10 +348,6 @@ export class EditorParts extends Disposable implements IEditorGroupsService, IEd
get partOptions() { return this.mainPart.partOptions; }
get onDidChangeEditorPartOptions() { return this.mainPart.onDidChangeEditorPartOptions; }

enforcePartOptions(options: IEditorPartOptions): IDisposable {
return this.mainPart.enforcePartOptions(options);
}

//#endregion
}

Expand Down
10 changes: 5 additions & 5 deletions src/vs/workbench/services/editor/common/editorGroupsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,6 @@ export interface IEditorGroupsContainer {
*/
readonly onDidChangeEditorPartOptions: Event<IEditorPartOptionsChangeEvent>;

/**
* Enforce editor part options temporarily.
*/
enforcePartOptions(options: DeepPartial<IEditorPartOptions>): IDisposable;

/**
* Allows to register a drag and drop target for editors
* on the provided `container`.
Expand Down Expand Up @@ -462,6 +457,11 @@ export interface IEditorPart extends IEditorGroupsContainer {
* Find out if the editor layout is currently centered.
*/
isLayoutCentered(): boolean;

/**
* Enforce editor part options temporarily.
*/
enforcePartOptions(options: DeepPartial<IEditorPartOptions>): IDisposable;
}

export interface IAuxiliaryEditorPart extends IEditorPart {
Expand Down

0 comments on commit 634df63

Please sign in to comment.