Skip to content

Commit

Permalink
:chore: consistent event names
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasero committed Feb 24, 2021
1 parent 7ffc518 commit 763e089
Show file tree
Hide file tree
Showing 32 changed files with 119 additions and 120 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class EditorScopedQuickInputServiceImpl extends QuickInputService {
_serviceBrand: undefined,
get container() { return contribution.widget.getDomNode(); },
get dimension() { return editor.getLayoutInfo(); },
get onLayout() { return editor.onDidLayoutChange; },
get onDidLayout() { return editor.onDidLayoutChange; },

This comment has been minimized.

Copy link
@jrieken

jrieken Feb 24, 2021

Member

@bpasero friendly reminder that we are in the endgame

focus: () => editor.focus()
};
}
Expand Down
2 changes: 1 addition & 1 deletion src/vs/editor/standalone/browser/simpleServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ export class SimpleUriLabelService implements ILabelService {
export class SimpleLayoutService implements ILayoutService {
declare readonly _serviceBrand: undefined;

public onLayout = Event.None;
public onDidLayout = Event.None;

private _dimension?: dom.IDimension;
get dimension(): dom.IDimension {
Expand Down
2 changes: 1 addition & 1 deletion src/vs/platform/contextview/browser/contextViewService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class ContextViewService extends Disposable implements IContextViewServic
this.contextView = this._register(new ContextView(this.container, ContextViewDOMPosition.ABSOLUTE));
this.layout();

this._register(layoutService.onLayout(() => this.layout()));
this._register(layoutService.onDidLayout(() => this.layout()));
}

// ContextView
Expand Down
2 changes: 1 addition & 1 deletion src/vs/platform/layout/browser/layoutService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export interface ILayoutService {
* An event that is emitted when the container is layed out. The
* event carries the dimensions of the container as part of it.
*/
readonly onLayout: Event<IDimension>;
readonly onDidLayout: Event<IDimension>;

/**
* Focus the primary component of the container.
Expand Down
2 changes: 1 addition & 1 deletion src/vs/platform/quickinput/browser/quickInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export class QuickInputService extends Themable implements IQuickInputService {
controller.layout(host.dimension, host.offset?.top ?? 0);

// Layout changes
this._register(host.onLayout(dimension => controller.layout(dimension, host.offset?.top ?? 0)));
this._register(host.onDidLayout(dimension => controller.layout(dimension, host.offset?.top ?? 0)));

// Context keys
this._register(controller.onShow(() => this.resetContextKeys()));
Expand Down
12 changes: 6 additions & 6 deletions src/vs/workbench/browser/contextkeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export class WorkbenchContextKeysHandler extends Disposable {

this._register(this.editorGroupService.onDidAddGroup(() => this.updateEditorContextKeys()));
this._register(this.editorGroupService.onDidRemoveGroup(() => this.updateEditorContextKeys()));
this._register(this.editorGroupService.onDidGroupIndexChange(() => this.updateEditorContextKeys()));
this._register(this.editorGroupService.onDidChangeGroupIndex(() => this.updateEditorContextKeys()));

this._register(addDisposableListener(window, EventType.FOCUS_IN, () => this.updateInputContextKeys(), true));

Expand All @@ -181,15 +181,15 @@ export class WorkbenchContextKeysHandler extends Disposable {
}
}));

this._register(this.layoutService.onZenModeChange(enabled => this.inZenModeContext.set(enabled)));
this._register(this.layoutService.onFullscreenChange(fullscreen => this.isFullscreenContext.set(fullscreen)));
this._register(this.layoutService.onCenteredLayoutChange(centered => this.isCenteredLayoutContext.set(centered)));
this._register(this.layoutService.onPanelPositionChange(position => this.panelPositionContext.set(position)));
this._register(this.layoutService.onDidChangeZenMode(enabled => this.inZenModeContext.set(enabled)));
this._register(this.layoutService.onDidChangeFullscreen(fullscreen => this.isFullscreenContext.set(fullscreen)));
this._register(this.layoutService.onDidChangeCenteredLayout(centered => this.isCenteredLayoutContext.set(centered)));
this._register(this.layoutService.onDidChangePanelPosition(position => this.panelPositionContext.set(position)));

this._register(this.viewletService.onDidViewletClose(() => this.updateSideBarContextKeys()));
this._register(this.viewletService.onDidViewletOpen(() => this.updateSideBarContextKeys()));

this._register(this.layoutService.onPartVisibilityChange(() => {
this._register(this.layoutService.onDidChangePartVisibility(() => {
this.editorAreaVisibleContext.set(this.layoutService.isVisible(Parts.EDITOR_PART));
this.panelVisibleContext.set(this.layoutService.isVisible(Parts.PANEL_PART));
this.panelMaximizedContext.set(this.layoutService.isPanelMaximized());
Expand Down
50 changes: 25 additions & 25 deletions src/vs/workbench/browser/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,29 +99,29 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi

//#region Events

private readonly _onZenModeChange = this._register(new Emitter<boolean>());
readonly onZenModeChange = this._onZenModeChange.event;
private readonly _onDidChangeZenMode = this._register(new Emitter<boolean>());
readonly onDidChangeZenMode = this._onDidChangeZenMode.event;

private readonly _onFullscreenChange = this._register(new Emitter<boolean>());
readonly onFullscreenChange = this._onFullscreenChange.event;
private readonly _onDidChangeFullscreen = this._register(new Emitter<boolean>());
readonly onDidChangeFullscreen = this._onDidChangeFullscreen.event;

private readonly _onCenteredLayoutChange = this._register(new Emitter<boolean>());
readonly onCenteredLayoutChange = this._onCenteredLayoutChange.event;
private readonly _onDidChangeCenteredLayout = this._register(new Emitter<boolean>());
readonly onDidChangeCenteredLayout = this._onDidChangeCenteredLayout.event;

private readonly _onMaximizeChange = this._register(new Emitter<boolean>());
readonly onMaximizeChange = this._onMaximizeChange.event;
private readonly _onDidChangeWindowMaximized = this._register(new Emitter<boolean>());
readonly onDidChangeWindowMaximized = this._onDidChangeWindowMaximized.event;

private readonly _onPanelPositionChange = this._register(new Emitter<string>());
readonly onPanelPositionChange = this._onPanelPositionChange.event;
private readonly _onDidChangePanelPosition = this._register(new Emitter<string>());
readonly onDidChangePanelPosition = this._onDidChangePanelPosition.event;

private readonly _onPartVisibilityChange = this._register(new Emitter<void>());
readonly onPartVisibilityChange = this._onPartVisibilityChange.event;
private readonly _onDidChangePartVisibility = this._register(new Emitter<void>());
readonly onDidChangePartVisibility = this._onDidChangePartVisibility.event;

private readonly _onNotificationsVisibilityChange = this._register(new Emitter<boolean>());
readonly onNotificationsVisibilityChange = this._onNotificationsVisibilityChange.event;
private readonly _onDidChangeNotificationsVisibility = this._register(new Emitter<boolean>());
readonly onDidChangeNotificationsVisibility = this._onDidChangeNotificationsVisibility.event;

private readonly _onLayout = this._register(new Emitter<IDimension>());
readonly onLayout = this._onLayout.event;
private readonly _onDidLayout = this._register(new Emitter<IDimension>());
readonly onDidLayout = this._onDidLayout.event;

//#endregion

Expand Down Expand Up @@ -368,7 +368,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
this.layout(); // handle title bar when fullscreen changes
}

this._onFullscreenChange.fire(this.state.fullscreen);
this._onDidChangeFullscreen.fire(this.state.fullscreen);
}

private onWindowFocusChanged(hasFocus: boolean): void {
Expand Down Expand Up @@ -818,8 +818,8 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
return part;
}

registerNotifications(delegate: { onNotificationsVisibilityChange: Event<boolean> }): void {
this._register(delegate.onNotificationsVisibilityChange(visible => this._onNotificationsVisibilityChange.fire(visible)));
registerNotifications(delegate: { onDidChangeNotificationsVisibility: Event<boolean> }): void {
this._register(delegate.onDidChangeNotificationsVisibility(visible => this._onDidChangeNotificationsVisibility.fire(visible)));
}

isRestored(): boolean {
Expand Down Expand Up @@ -1097,7 +1097,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
}

// Event
this._onZenModeChange.fire(this.state.zenMode.active);
this._onDidChangeZenMode.fire(this.state.zenMode.active);

// State
if (this.state.zenMode.active) {
Expand Down Expand Up @@ -1176,7 +1176,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
} else if (part === editorPart) {
this.setEditorHidden(!visible, true);
}
this._onPartVisibilityChange.fire();
this._onDidChangePartVisibility.fire();
}));
}

Expand Down Expand Up @@ -1218,7 +1218,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
this.workbenchGrid.layout(this._dimension.width, this._dimension.height);

// Emit as event
this._onLayout.fire(this._dimension);
this._onDidLayout.fire(this._dimension);
}
}

Expand Down Expand Up @@ -1256,7 +1256,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
}
}

this._onCenteredLayoutChange.fire(this.state.editor.centered);
this._onDidChangeCenteredLayout.fire(this.state.editor.centered);
}

resizePart(part: Parts, sizeChangeWidth: number, sizeChangeHeight: number): void {
Expand Down Expand Up @@ -1643,7 +1643,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
// Reset sidebar to original size before shifting the panel
this.workbenchGrid.resizeView(this.sideBarPartView, sideBarSize);

this._onPanelPositionChange.fire(newPositionValue);
this._onDidChangePanelPosition.fire(newPositionValue);
}

isWindowMaximized() {
Expand All @@ -1658,7 +1658,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
this.state.maximized = maximized;

this.updateWindowBorder();
this._onMaximizeChange.fire(maximized);
this._onDidChangeWindowMaximized.fire(maximized);
}

getVisibleNeighborPart(part: Parts, direction: Direction): Parts | undefined {
Expand Down
6 changes: 3 additions & 3 deletions src/vs/workbench/browser/parts/editor/binaryEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ export interface IOpenCallbacks {
*/
export abstract class BaseBinaryResourceEditor extends EditorPane {

private readonly _onMetadataChanged = this._register(new Emitter<void>());
readonly onMetadataChanged = this._onMetadataChanged.event;
private readonly _onDidChangeMetadata = this._register(new Emitter<void>());
readonly onDidChangeMetadata = this._onDidChangeMetadata.event;

private readonly _onDidOpenInPlace = this._register(new Emitter<void>());
readonly onDidOpenInPlace = this._onDidOpenInPlace.event;
Expand Down Expand Up @@ -111,7 +111,7 @@ export abstract class BaseBinaryResourceEditor extends EditorPane {
private handleMetadataChanged(meta: string | undefined): void {
this.metadata = meta;

this._onMetadataChanged.fire();
this._onDidChangeMetadata.fire();
}

getMetadata(): string | undefined {
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/browser/parts/editor/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export interface IEditorGroupsAccessor {
readonly activeGroup: IEditorGroupView;

readonly partOptions: IEditorPartOptions;
readonly onDidEditorPartOptionsChange: Event<IEditorPartOptionsChangeEvent>;
readonly onDidChangeEditorPartOptions: Event<IEditorPartOptionsChangeEvent>;

readonly onDidVisibilityChange: Event<boolean>;

Expand Down
8 changes: 4 additions & 4 deletions src/vs/workbench/browser/parts/editor/editorControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ export class EditorControl extends Disposable {
private readonly _onDidFocus = this._register(new Emitter<void>());
readonly onDidFocus = this._onDidFocus.event;

private _onDidSizeConstraintsChange = this._register(new Emitter<{ width: number; height: number; } | undefined>());
readonly onDidSizeConstraintsChange = this._onDidSizeConstraintsChange.event;
private _onDidChangeSizeConstraints = this._register(new Emitter<{ width: number; height: number; } | undefined>());
readonly onDidChangeSizeConstraints = this._onDidChangeSizeConstraints.event;

private _activeEditorPane: EditorPane | null = null;
get activeEditorPane(): IVisibleEditorPane | null { return this._activeEditorPane as IVisibleEditorPane | null; }
Expand Down Expand Up @@ -139,12 +139,12 @@ export class EditorControl extends Disposable {

// Listen to editor pane changes
if (editorPane) {
this.activeEditorPaneDisposables.add(editorPane.onDidSizeConstraintsChange(e => this._onDidSizeConstraintsChange.fire(e)));
this.activeEditorPaneDisposables.add(editorPane.onDidChangeSizeConstraints(e => this._onDidChangeSizeConstraints.fire(e)));
this.activeEditorPaneDisposables.add(editorPane.onDidFocus(() => this._onDidFocus.fire()));
}

// Indicate that size constraints could have changed due to new editor
this._onDidSizeConstraintsChange.fire(undefined);
this._onDidChangeSizeConstraints.fire(undefined);
}

private async doSetInput(editorPane: EditorPane, editor: EditorInput, options: EditorOptions | undefined, context: IEditorOpenContext): Promise<boolean> {
Expand Down
6 changes: 3 additions & 3 deletions src/vs/workbench/browser/parts/editor/editorGroupView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {

// Editor control
this.editorControl = this._register(this.scopedInstantiationService.createInstance(EditorControl, this.editorContainer, this));
this._onDidChange.input = this.editorControl.onDidSizeConstraintsChange;
this._onDidChange.input = this.editorControl.onDidChangeSizeConstraints;

// Track Focus
this.doTrackFocus();
Expand Down Expand Up @@ -489,7 +489,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
this._register(this._group.onDidEditorLabelChange(editor => this.onDidEditorLabelChange(editor)));

// Option Changes
this._register(this.accessor.onDidEditorPartOptionsChange(e => this.onDidEditorPartOptionsChange(e)));
this._register(this.accessor.onDidChangeEditorPartOptions(e => this.onDidChangeEditorPartOptions(e)));

// Visibility
this._register(this.accessor.onDidVisibilityChange(e => this.onDidVisibilityChange(e)));
Expand Down Expand Up @@ -616,7 +616,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
}
}

private onDidEditorPartOptionsChange(event: IEditorPartOptionsChangeEvent): void {
private onDidChangeEditorPartOptions(event: IEditorPartOptionsChangeEvent): void {

// Title container
this.updateTitleContainer();
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/browser/parts/editor/editorPane.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export abstract class EditorPane extends Composite implements IEditorPane {
get minimumHeight() { return DEFAULT_EDITOR_MIN_DIMENSIONS.height; }
get maximumHeight() { return DEFAULT_EDITOR_MAX_DIMENSIONS.height; }

readonly onDidSizeConstraintsChange = Event.None;
readonly onDidChangeSizeConstraints = Event.None;

protected _input: EditorInput | undefined;
get input(): EditorInput | undefined { return this._input; }
Expand Down
24 changes: 12 additions & 12 deletions src/vs/workbench/browser/parts/editor/editorPart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
private readonly _onDidLayout = this._register(new Emitter<Dimension>());
readonly onDidLayout = this._onDidLayout.event;

private readonly _onDidActiveGroupChange = this._register(new Emitter<IEditorGroupView>());
readonly onDidActiveGroupChange = this._onDidActiveGroupChange.event;
private readonly _onDidChangeActiveGroup = this._register(new Emitter<IEditorGroupView>());
readonly onDidChangeActiveGroup = this._onDidChangeActiveGroup.event;

private readonly _onDidGroupIndexChange = this._register(new Emitter<IEditorGroupView>());
readonly onDidGroupIndexChange = this._onDidGroupIndexChange.event;
private readonly _onDidChangeGroupIndex = this._register(new Emitter<IEditorGroupView>());
readonly onDidChangeGroupIndex = this._onDidChangeGroupIndex.event;

private readonly _onDidActivateGroup = this._register(new Emitter<IEditorGroupView>());
readonly onDidActivateGroup = this._onDidActivateGroup.event;
Expand All @@ -113,11 +113,11 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro

private readonly onDidSetGridWidget = this._register(new Emitter<{ width: number; height: number; } | undefined>());

private readonly _onDidSizeConstraintsChange = this._register(new Relay<{ width: number; height: number; } | undefined>());
readonly onDidSizeConstraintsChange = Event.any(this.onDidSetGridWidget.event, this._onDidSizeConstraintsChange.event);
private readonly _onDidChangeSizeConstraints = this._register(new Relay<{ width: number; height: number; } | undefined>());
readonly onDidChangeSizeConstraints = Event.any(this.onDidSetGridWidget.event, this._onDidChangeSizeConstraints.event);

private readonly _onDidEditorPartOptionsChange = this._register(new Emitter<IEditorPartOptionsChangeEvent>());
readonly onDidEditorPartOptionsChange = this._onDidEditorPartOptionsChange.event;
private readonly _onDidChangeEditorPartOptions = this._register(new Emitter<IEditorPartOptionsChangeEvent>());
readonly onDidChangeEditorPartOptions = this._onDidChangeEditorPartOptions.event;

//#endregion

Expand Down Expand Up @@ -177,7 +177,7 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro

this._partOptions = newPartOptions;

this._onDidEditorPartOptionsChange.fire({ oldPartOptions, newPartOptions });
this._onDidChangeEditorPartOptions.fire({ oldPartOptions, newPartOptions });
}

//#region IEditorGroupsService
Expand Down Expand Up @@ -550,7 +550,7 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
this.updateContainer();
break;
case GroupChangeKind.GROUP_INDEX:
this._onDidGroupIndexChange.fire(groupView);
this._onDidChangeGroupIndex.fire(groupView);
break;
}
}));
Expand Down Expand Up @@ -588,7 +588,7 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
this.doRestoreGroup(group);

// Event
this._onDidActiveGroupChange.fire(group);
this._onDidChangeActiveGroup.fire(group);
}

private doRestoreGroup(group: IEditorGroupView): void {
Expand Down Expand Up @@ -1046,7 +1046,7 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
this.gridWidget.boundarySashes = boundarySashes;
this.gridWidgetView.gridWidget = gridWidget;

this._onDidSizeConstraintsChange.input = gridWidget.onDidChange;
this._onDidChangeSizeConstraints.input = gridWidget.onDidChange;

this.onDidSetGridWidget.fire(undefined);
}
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/browser/parts/editor/editorStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ export class EditorStatus extends Disposable implements IWorkbenchContribution {
}

binaryEditors.forEach(editor => {
this.activeEditorListeners.add(editor.onMetadataChanged(metadata => {
this.activeEditorListeners.add(editor.onDidChangeMetadata(metadata => {
this.onMetadataChange(activeEditorPane);
}));

Expand Down
4 changes: 2 additions & 2 deletions src/vs/workbench/browser/parts/editor/editorsObserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class EditorsObserver extends Disposable {
private registerListeners(): void {
this._register(this.storageService.onWillSaveState(() => this.saveState()));
this._register(this.editorGroupsService.onDidAddGroup(group => this.onGroupAdded(group)));
this._register(this.editorGroupsService.onDidEditorPartOptionsChange(e => this.onDidEditorPartOptionsChange(e)));
this._register(this.editorGroupsService.onDidChangeEditorPartOptions(e => this.onDidChangeEditorPartOptions(e)));

this.editorGroupsService.whenRestored.then(() => this.loadState());
}
Expand Down Expand Up @@ -142,7 +142,7 @@ export class EditorsObserver extends Disposable {
Event.once(group.onWillDispose)(() => dispose(groupDisposables));
}

private onDidEditorPartOptionsChange(event: IEditorPartOptionsChangeEvent): void {
private onDidChangeEditorPartOptions(event: IEditorPartOptionsChangeEvent): void {
if (!equals(event.newPartOptions.limit, event.oldPartOptions.limit)) {
const activeGroup = this.editorGroupsService.activeGroup;
let exclude: IEditorIdentifier | undefined = undefined;
Expand Down
Loading

0 comments on commit 763e089

Please sign in to comment.