Skip to content

Commit f44d46d

Browse files
author
Benjamin Pasero
committed
editors - baseEditor => editorPane
1 parent 4dcc6b5 commit f44d46d

20 files changed

Lines changed: 69 additions & 68 deletions

File tree

src/vs/workbench/browser/editor.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,18 @@
66
import { EditorInput } from 'vs/workbench/common/editor';
77
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
88
import { Registry } from 'vs/platform/registry/common/platform';
9-
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
9+
import { EditorPane } from 'vs/workbench/browser/parts/editor/editorPane';
1010
import { IConstructorSignature0, IInstantiationService, BrandedService } from 'vs/platform/instantiation/common/instantiation';
1111
import { insert } from 'vs/base/common/arrays';
1212
import { IDisposable, toDisposable } from 'vs/base/common/lifecycle';
1313

1414
export interface IEditorDescriptor {
15-
instantiate(instantiationService: IInstantiationService): BaseEditor;
1615

1716
getId(): string;
1817
getName(): string;
1918

19+
instantiate(instantiationService: IInstantiationService): EditorPane;
20+
2021
describes(obj: unknown): boolean;
2122
}
2223

@@ -56,20 +57,20 @@ export interface IEditorRegistry {
5657
export class EditorDescriptor implements IEditorDescriptor {
5758

5859
static create<Services extends BrandedService[]>(
59-
ctor: { new(...services: Services): BaseEditor },
60+
ctor: { new(...services: Services): EditorPane },
6061
id: string,
6162
name: string
6263
): EditorDescriptor {
63-
return new EditorDescriptor(ctor as IConstructorSignature0<BaseEditor>, id, name);
64+
return new EditorDescriptor(ctor as IConstructorSignature0<EditorPane>, id, name);
6465
}
6566

6667
constructor(
67-
private readonly ctor: IConstructorSignature0<BaseEditor>,
68+
private readonly ctor: IConstructorSignature0<EditorPane>,
6869
private readonly id: string,
6970
private readonly name: string
7071
) { }
7172

72-
instantiate(instantiationService: IInstantiationService): BaseEditor {
73+
instantiate(instantiationService: IInstantiationService): EditorPane {
7374
return instantiationService.createInstance(this.ctor);
7475
}
7576

@@ -82,7 +83,7 @@ export class EditorDescriptor implements IEditorDescriptor {
8283
}
8384

8485
describes(obj: unknown): boolean {
85-
return obj instanceof BaseEditor && obj.getId() === this.id;
86+
return obj instanceof EditorPane && obj.getId() === this.id;
8687
}
8788
}
8889

src/vs/workbench/browser/parts/editor/binaryEditor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import 'vs/css!./media/binaryeditor';
77
import * as nls from 'vs/nls';
88
import { Emitter } from 'vs/base/common/event';
99
import { EditorInput, EditorOptions, IEditorOpenContext } from 'vs/workbench/common/editor';
10-
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
10+
import { EditorPane } from 'vs/workbench/browser/parts/editor/editorPane';
1111
import { BinaryEditorModel } from 'vs/workbench/common/editor/binaryEditorModel';
1212
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
1313
import { DomScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement';
@@ -30,7 +30,7 @@ export interface IOpenCallbacks {
3030
/*
3131
* This class is only intended to be subclassed and not instantiated.
3232
*/
33-
export abstract class BaseBinaryResourceEditor extends BaseEditor {
33+
export abstract class BaseBinaryResourceEditor extends EditorPane {
3434

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

src/vs/workbench/browser/parts/editor/editorControl.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ import { Dimension, show, hide, addClass } from 'vs/base/browser/dom';
99
import { Registry } from 'vs/platform/registry/common/platform';
1010
import { IEditorRegistry, Extensions as EditorExtensions, IEditorDescriptor } from 'vs/workbench/browser/editor';
1111
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
12-
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
12+
import { EditorPane } from 'vs/workbench/browser/parts/editor/editorPane';
1313
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
1414
import { IEditorProgressService, LongRunningOperation } from 'vs/platform/progress/common/progress';
1515
import { IEditorGroupView, DEFAULT_EDITOR_MIN_DIMENSIONS, DEFAULT_EDITOR_MAX_DIMENSIONS } from 'vs/workbench/browser/parts/editor/editor';
1616
import { Emitter } from 'vs/base/common/event';
1717
import { assertIsDefined } from 'vs/base/common/types';
1818

1919
export interface IOpenEditorResult {
20-
readonly editorPane: BaseEditor;
20+
readonly editorPane: EditorPane;
2121
readonly editorChanged: boolean;
2222
}
2323

@@ -34,10 +34,10 @@ export class EditorControl extends Disposable {
3434
private _onDidSizeConstraintsChange = this._register(new Emitter<{ width: number; height: number; } | undefined>());
3535
readonly onDidSizeConstraintsChange = this._onDidSizeConstraintsChange.event;
3636

37-
private _activeEditorPane: BaseEditor | null = null;
37+
private _activeEditorPane: EditorPane | null = null;
3838
get activeEditorPane(): IVisibleEditorPane | null { return this._activeEditorPane as IVisibleEditorPane | null; }
3939

40-
private readonly editorPanes: BaseEditor[] = [];
40+
private readonly editorPanes: EditorPane[] = [];
4141

4242
private readonly activeEditorPaneDisposables = this._register(new DisposableStore());
4343
private dimension: Dimension | undefined;
@@ -67,7 +67,7 @@ export class EditorControl extends Disposable {
6767
return { editorPane, editorChanged };
6868
}
6969

70-
private doShowEditorPane(descriptor: IEditorDescriptor): BaseEditor {
70+
private doShowEditorPane(descriptor: IEditorDescriptor): EditorPane {
7171

7272
// Return early if the currently active editor pane can handle the input
7373
if (this._activeEditorPane && descriptor.describes(this._activeEditorPane)) {
@@ -99,7 +99,7 @@ export class EditorControl extends Disposable {
9999
return editorPane;
100100
}
101101

102-
private doCreateEditorPane(descriptor: IEditorDescriptor): BaseEditor {
102+
private doCreateEditorPane(descriptor: IEditorDescriptor): EditorPane {
103103

104104
// Instantiate editor
105105
const editorPane = this.doInstantiateEditorPane(descriptor);
@@ -116,7 +116,7 @@ export class EditorControl extends Disposable {
116116
return editorPane;
117117
}
118118

119-
private doInstantiateEditorPane(descriptor: IEditorDescriptor): BaseEditor {
119+
private doInstantiateEditorPane(descriptor: IEditorDescriptor): EditorPane {
120120

121121
// Return early if already instantiated
122122
const existingEditorPane = this.editorPanes.find(editorPane => descriptor.describes(editorPane));
@@ -131,7 +131,7 @@ export class EditorControl extends Disposable {
131131
return editorPane;
132132
}
133133

134-
private doSetActiveEditorPane(editorPane: BaseEditor | null) {
134+
private doSetActiveEditorPane(editorPane: EditorPane | null) {
135135
this._activeEditorPane = editorPane;
136136

137137
// Clear out previous active editor pane listeners
@@ -147,7 +147,7 @@ export class EditorControl extends Disposable {
147147
this._onDidSizeConstraintsChange.fire(undefined);
148148
}
149149

150-
private async doSetInput(editorPane: BaseEditor, editor: EditorInput, options: EditorOptions | undefined, context: IEditorOpenContext): Promise<boolean> {
150+
private async doSetInput(editorPane: EditorPane, editor: EditorInput, options: EditorOptions | undefined, context: IEditorOpenContext): Promise<boolean> {
151151

152152
// If the input did not change, return early and only apply the options
153153
// unless the options instruct us to force open it even if it is the same

src/vs/workbench/browser/parts/editor/baseEditor.ts renamed to src/vs/workbench/browser/parts/editor/editorPane.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import { IDisposable } from 'vs/base/common/lifecycle';
4141
*
4242
* This class is only intended to be subclassed and not instantiated.
4343
*/
44-
export abstract class BaseEditor extends Composite implements IEditorPane {
44+
export abstract class EditorPane extends Composite implements IEditorPane {
4545

4646
private static readonly EDITOR_MEMENTOS = new Map<string, EditorMemento<any>>();
4747

@@ -148,10 +148,10 @@ export abstract class BaseEditor extends Composite implements IEditorPane {
148148
protected getEditorMemento<T>(editorGroupService: IEditorGroupsService, key: string, limit: number = 10): IEditorMemento<T> {
149149
const mementoKey = `${this.getId()}${key}`;
150150

151-
let editorMemento = BaseEditor.EDITOR_MEMENTOS.get(mementoKey);
151+
let editorMemento = EditorPane.EDITOR_MEMENTOS.get(mementoKey);
152152
if (!editorMemento) {
153153
editorMemento = new EditorMemento(this.getId(), key, this.getMemento(StorageScope.WORKSPACE), limit, editorGroupService);
154-
BaseEditor.EDITOR_MEMENTOS.set(mementoKey, editorMemento);
154+
EditorPane.EDITOR_MEMENTOS.set(mementoKey, editorMemento);
155155
}
156156

157157
return editorMemento;
@@ -160,7 +160,7 @@ export abstract class BaseEditor extends Composite implements IEditorPane {
160160
protected saveState(): void {
161161

162162
// Save all editor memento for this editor type
163-
BaseEditor.EDITOR_MEMENTOS.forEach(editorMemento => {
163+
EditorPane.EDITOR_MEMENTOS.forEach(editorMemento => {
164164
if (editorMemento.id === this.getId()) {
165165
editorMemento.saveState();
166166
}

src/vs/workbench/browser/parts/editor/sideBySideEditor.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import * as DOM from 'vs/base/browser/dom';
77
import { Registry } from 'vs/platform/registry/common/platform';
88
import { EditorInput, EditorOptions, SideBySideEditorInput, IEditorControl, IEditorPane, IEditorOpenContext } from 'vs/workbench/common/editor';
9-
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
9+
import { EditorPane } from 'vs/workbench/browser/parts/editor/editorPane';
1010
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
1111
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
1212
import { IThemeService } from 'vs/platform/theme/common/themeService';
@@ -19,7 +19,7 @@ import { Event, Relay, Emitter } from 'vs/base/common/event';
1919
import { IStorageService } from 'vs/platform/storage/common/storage';
2020
import { assertIsDefined } from 'vs/base/common/types';
2121

22-
export class SideBySideEditor extends BaseEditor {
22+
export class SideBySideEditor extends EditorPane {
2323

2424
static readonly ID: string = 'workbench.editor.sidebysideEditor';
2525

@@ -33,7 +33,7 @@ export class SideBySideEditor extends BaseEditor {
3333
private get minimumSecondaryHeight() { return this.secondaryEditorPane ? this.secondaryEditorPane.minimumHeight : 0; }
3434
private get maximumSecondaryHeight() { return this.secondaryEditorPane ? this.secondaryEditorPane.maximumHeight : Number.POSITIVE_INFINITY; }
3535

36-
// these setters need to exist because this extends from BaseEditor
36+
// these setters need to exist because this extends from EditorPane
3737
set minimumWidth(value: number) { /* noop */ }
3838
set maximumWidth(value: number) { /* noop */ }
3939
set minimumHeight(value: number) { /* noop */ }
@@ -44,8 +44,8 @@ export class SideBySideEditor extends BaseEditor {
4444
get minimumHeight() { return this.minimumPrimaryHeight + this.minimumSecondaryHeight; }
4545
get maximumHeight() { return this.maximumPrimaryHeight + this.maximumSecondaryHeight; }
4646

47-
protected primaryEditorPane?: BaseEditor;
48-
protected secondaryEditorPane?: BaseEditor;
47+
protected primaryEditorPane?: EditorPane;
48+
protected secondaryEditorPane?: EditorPane;
4949

5050
private primaryEditorContainer: HTMLElement | undefined;
5151
private secondaryEditorContainer: HTMLElement | undefined;
@@ -188,7 +188,7 @@ export class SideBySideEditor extends BaseEditor {
188188
return this.onEditorsCreated(secondaryEditor, primaryEditor, newInput.secondary, newInput.primary, options, context, token);
189189
}
190190

191-
private doCreateEditor(editorInput: EditorInput, container: HTMLElement): BaseEditor {
191+
private doCreateEditor(editorInput: EditorInput, container: HTMLElement): EditorPane {
192192
const descriptor = Registry.as<IEditorRegistry>(EditorExtensions.Editors).getEditor(editorInput);
193193
if (!descriptor) {
194194
throw new Error('No descriptor for editor found');
@@ -201,7 +201,7 @@ export class SideBySideEditor extends BaseEditor {
201201
return editor;
202202
}
203203

204-
private async onEditorsCreated(secondary: BaseEditor, primary: BaseEditor, secondaryInput: EditorInput, primaryInput: EditorInput, options: EditorOptions | undefined, context: IEditorOpenContext, token: CancellationToken): Promise<void> {
204+
private async onEditorsCreated(secondary: EditorPane, primary: EditorPane, secondaryInput: EditorInput, primaryInput: EditorInput, options: EditorOptions | undefined, context: IEditorOpenContext, token: CancellationToken): Promise<void> {
205205
this.secondaryEditorPane = secondary;
206206
this.primaryEditorPane = primary;
207207

src/vs/workbench/browser/parts/editor/textEditor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { isObject, assertIsDefined, withNullAsUndefined, isFunction } from 'vs/b
1111
import { Dimension } from 'vs/base/browser/dom';
1212
import { CodeEditorWidget } from 'vs/editor/browser/widget/codeEditorWidget';
1313
import { EditorInput, EditorOptions, IEditorMemento, ITextEditorPane, TextEditorOptions, IEditorCloseEvent, IEditorInput, computeEditorAriaLabel, IEditorOpenContext, toResource, SideBySideEditor } from 'vs/workbench/common/editor';
14-
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
14+
import { EditorPane } from 'vs/workbench/browser/parts/editor/editorPane';
1515
import { IEditorViewState, IEditor, ScrollType } from 'vs/editor/common/editorCommon';
1616
import { IStorageService } from 'vs/platform/storage/common/storage';
1717
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
@@ -35,7 +35,7 @@ export interface IEditorConfiguration {
3535
* The base class of editors that leverage the text editor for the editing experience. This class is only intended to
3636
* be subclassed and not instantiated.
3737
*/
38-
export abstract class BaseTextEditor extends BaseEditor implements ITextEditorPane {
38+
export abstract class BaseTextEditor extends EditorPane implements ITextEditorPane {
3939

4040
static readonly TEXT_EDITOR_VIEW_STATE_PREFERENCE_KEY = 'textEditorViewState';
4141

src/vs/workbench/browser/parts/editor/titleControl.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
2828
import { listActiveSelectionBackground, listActiveSelectionForeground } from 'vs/platform/theme/common/colorRegistry';
2929
import { ICssStyleCollector, IColorTheme, IThemeService, registerThemingParticipant, Themable } from 'vs/platform/theme/common/themeService';
3030
import { DraggedEditorGroupIdentifier, DraggedEditorIdentifier, fillResourceDataTransfers, LocalSelectionTransfer } from 'vs/workbench/browser/dnd';
31-
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
31+
import { EditorPane } from 'vs/workbench/browser/parts/editor/editorPane';
3232
import { BreadcrumbsConfig } from 'vs/workbench/browser/parts/editor/breadcrumbs';
3333
import { BreadcrumbsControl, IBreadcrumbsControlOptions } from 'vs/workbench/browser/parts/editor/breadcrumbsControl';
3434
import { IEditorGroupsAccessor, IEditorGroupView } from 'vs/workbench/browser/parts/editor/editor';
@@ -163,7 +163,7 @@ export abstract class TitleControl extends Themable {
163163
const activeEditorPane = this.group.activeEditorPane;
164164

165165
// Check Active Editor
166-
if (activeEditorPane instanceof BaseEditor) {
166+
if (activeEditorPane instanceof EditorPane) {
167167
const result = activeEditorPane.getActionViewItem(action);
168168

169169
if (result) {
@@ -236,7 +236,7 @@ export abstract class TitleControl extends Themable {
236236

237237
// Editor actions require the editor control to be there, so we retrieve it via service
238238
const activeEditorPane = this.group.activeEditorPane;
239-
if (activeEditorPane instanceof BaseEditor) {
239+
if (activeEditorPane instanceof EditorPane) {
240240
const codeEditor = getCodeEditor(activeEditorPane.getControl());
241241
const scopedContextKeyService = codeEditor?.invokeWithinContext(accessor => accessor.get(IContextKeyService)) || this.contextKeyService;
242242
const titleBarMenu = this.menuService.createMenu(MenuId.EditorTitle, scopedContextKeyService);

src/vs/workbench/common/editor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1138,7 +1138,7 @@ export class TextEditorOptions extends EditorOptions implements ITextEditorOptio
11381138
}
11391139

11401140
/**
1141-
* Context passed into `BaseEditor#setInput` to give additional
1141+
* Context passed into `EditorPane#setInput` to give additional
11421142
* context information around why the editor was opened.
11431143
*/
11441144
export interface IEditorOpenContext {

src/vs/workbench/contrib/extensions/browser/extensionEditor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { isPromiseCanceledError } from 'vs/base/common/errors';
1515
import { dispose, toDisposable, Disposable, DisposableStore, IDisposable } from 'vs/base/common/lifecycle';
1616
import { domEvent } from 'vs/base/browser/event';
1717
import { append, $, addClass, removeClass, finalHandler, join, toggleClass, hide, show, addDisposableListener, EventType } from 'vs/base/browser/dom';
18-
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
18+
import { EditorPane } from 'vs/workbench/browser/parts/editor/editorPane';
1919
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
2020
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
2121
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
@@ -164,7 +164,7 @@ interface IExtensionEditorTemplate {
164164
header: HTMLElement;
165165
}
166166

167-
export class ExtensionEditor extends BaseEditor {
167+
export class ExtensionEditor extends EditorPane {
168168

169169
static readonly ID: string = 'workbench.editor.extension';
170170

src/vs/workbench/contrib/extensions/electron-browser/runtimeExtensionsEditor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import * as nls from 'vs/nls';
88
import * as os from 'os';
99
import { IProductService } from 'vs/platform/product/common/productService';
1010
import { Action, IAction, Separator } from 'vs/base/common/actions';
11-
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
11+
import { EditorPane } from 'vs/workbench/browser/parts/editor/editorPane';
1212
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
1313
import { IInstantiationService, createDecorator } from 'vs/platform/instantiation/common/instantiation';
1414
import { IExtensionsWorkbenchService, IExtension } from 'vs/workbench/contrib/extensions/common/extensions';
@@ -100,7 +100,7 @@ interface IRuntimeExtension {
100100
unresponsiveProfile?: IExtensionHostProfile;
101101
}
102102

103-
export class RuntimeExtensionsEditor extends BaseEditor {
103+
export class RuntimeExtensionsEditor extends EditorPane {
104104

105105
public static readonly ID: string = 'workbench.editor.runtimeExtensions';
106106

0 commit comments

Comments
 (0)