This commit is contained in:
Alexandru Dima
2022-11-25 17:27:59 +01:00
committed by GitHub
parent 9a188c9b52
commit b6c2269cfd
2 changed files with 25 additions and 25 deletions

View File

@@ -118,7 +118,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
//#region Eventing
private readonly _deliveryQueue = new EventDeliveryQueue();
protected readonly _contributions2: CodeEditorContributions = this._register(new CodeEditorContributions());
protected readonly _contributions: CodeEditorContributions = this._register(new CodeEditorContributions());
private readonly _onDidDispose: Emitter<void> = this._register(new Emitter<void>());
public readonly onDidDispose: Event<void> = this._onDidDispose.event;
@@ -153,7 +153,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
private readonly _onDidChangeCursorSelection: Emitter<ICursorSelectionChangedEvent> = this._register(new Emitter<ICursorSelectionChangedEvent>({ deliveryQueue: this._deliveryQueue }));
public readonly onDidChangeCursorSelection: Event<ICursorSelectionChangedEvent> = this._onDidChangeCursorSelection.event;
private readonly _onDidAttemptReadOnlyEdit: Emitter<void> = this._register(new InteractionEmitter<void>(this._contributions2, this._deliveryQueue));
private readonly _onDidAttemptReadOnlyEdit: Emitter<void> = this._register(new InteractionEmitter<void>(this._contributions, this._deliveryQueue));
public readonly onDidAttemptReadOnlyEdit: Event<void> = this._onDidAttemptReadOnlyEdit.event;
private readonly _onDidLayoutChange: Emitter<EditorLayoutInfo> = this._register(new Emitter<EditorLayoutInfo>({ deliveryQueue: this._deliveryQueue }));
@@ -167,55 +167,55 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
public readonly onDidFocusEditorWidget: Event<void> = this._editorWidgetFocus.onDidChangeToTrue;
public readonly onDidBlurEditorWidget: Event<void> = this._editorWidgetFocus.onDidChangeToFalse;
private readonly _onWillType: Emitter<string> = this._register(new InteractionEmitter<string>(this._contributions2, this._deliveryQueue));
private readonly _onWillType: Emitter<string> = this._register(new InteractionEmitter<string>(this._contributions, this._deliveryQueue));
public readonly onWillType = this._onWillType.event;
private readonly _onDidType: Emitter<string> = this._register(new InteractionEmitter<string>(this._contributions2, this._deliveryQueue));
private readonly _onDidType: Emitter<string> = this._register(new InteractionEmitter<string>(this._contributions, this._deliveryQueue));
public readonly onDidType = this._onDidType.event;
private readonly _onDidCompositionStart: Emitter<void> = this._register(new InteractionEmitter<void>(this._contributions2, this._deliveryQueue));
private readonly _onDidCompositionStart: Emitter<void> = this._register(new InteractionEmitter<void>(this._contributions, this._deliveryQueue));
public readonly onDidCompositionStart = this._onDidCompositionStart.event;
private readonly _onDidCompositionEnd: Emitter<void> = this._register(new InteractionEmitter<void>(this._contributions2, this._deliveryQueue));
private readonly _onDidCompositionEnd: Emitter<void> = this._register(new InteractionEmitter<void>(this._contributions, this._deliveryQueue));
public readonly onDidCompositionEnd = this._onDidCompositionEnd.event;
private readonly _onDidPaste: Emitter<editorBrowser.IPasteEvent> = this._register(new InteractionEmitter<editorBrowser.IPasteEvent>(this._contributions2, this._deliveryQueue));
private readonly _onDidPaste: Emitter<editorBrowser.IPasteEvent> = this._register(new InteractionEmitter<editorBrowser.IPasteEvent>(this._contributions, this._deliveryQueue));
public readonly onDidPaste = this._onDidPaste.event;
private readonly _onMouseUp: Emitter<editorBrowser.IEditorMouseEvent> = this._register(new InteractionEmitter<editorBrowser.IEditorMouseEvent>(this._contributions2, this._deliveryQueue));
private readonly _onMouseUp: Emitter<editorBrowser.IEditorMouseEvent> = this._register(new InteractionEmitter<editorBrowser.IEditorMouseEvent>(this._contributions, this._deliveryQueue));
public readonly onMouseUp: Event<editorBrowser.IEditorMouseEvent> = this._onMouseUp.event;
private readonly _onMouseDown: Emitter<editorBrowser.IEditorMouseEvent> = this._register(new InteractionEmitter<editorBrowser.IEditorMouseEvent>(this._contributions2, this._deliveryQueue));
private readonly _onMouseDown: Emitter<editorBrowser.IEditorMouseEvent> = this._register(new InteractionEmitter<editorBrowser.IEditorMouseEvent>(this._contributions, this._deliveryQueue));
public readonly onMouseDown: Event<editorBrowser.IEditorMouseEvent> = this._onMouseDown.event;
private readonly _onMouseDrag: Emitter<editorBrowser.IEditorMouseEvent> = this._register(new InteractionEmitter<editorBrowser.IEditorMouseEvent>(this._contributions2, this._deliveryQueue));
private readonly _onMouseDrag: Emitter<editorBrowser.IEditorMouseEvent> = this._register(new InteractionEmitter<editorBrowser.IEditorMouseEvent>(this._contributions, this._deliveryQueue));
public readonly onMouseDrag: Event<editorBrowser.IEditorMouseEvent> = this._onMouseDrag.event;
private readonly _onMouseDrop: Emitter<editorBrowser.IPartialEditorMouseEvent> = this._register(new InteractionEmitter<editorBrowser.IPartialEditorMouseEvent>(this._contributions2, this._deliveryQueue));
private readonly _onMouseDrop: Emitter<editorBrowser.IPartialEditorMouseEvent> = this._register(new InteractionEmitter<editorBrowser.IPartialEditorMouseEvent>(this._contributions, this._deliveryQueue));
public readonly onMouseDrop: Event<editorBrowser.IPartialEditorMouseEvent> = this._onMouseDrop.event;
private readonly _onMouseDropCanceled: Emitter<void> = this._register(new InteractionEmitter<void>(this._contributions2, this._deliveryQueue));
private readonly _onMouseDropCanceled: Emitter<void> = this._register(new InteractionEmitter<void>(this._contributions, this._deliveryQueue));
public readonly onMouseDropCanceled: Event<void> = this._onMouseDropCanceled.event;
private readonly _onDropIntoEditor = this._register(new InteractionEmitter<{ readonly position: IPosition; readonly event: DragEvent }>(this._contributions2, this._deliveryQueue));
private readonly _onDropIntoEditor = this._register(new InteractionEmitter<{ readonly position: IPosition; readonly event: DragEvent }>(this._contributions, this._deliveryQueue));
public readonly onDropIntoEditor = this._onDropIntoEditor.event;
private readonly _onContextMenu: Emitter<editorBrowser.IEditorMouseEvent> = this._register(new InteractionEmitter<editorBrowser.IEditorMouseEvent>(this._contributions2, this._deliveryQueue));
private readonly _onContextMenu: Emitter<editorBrowser.IEditorMouseEvent> = this._register(new InteractionEmitter<editorBrowser.IEditorMouseEvent>(this._contributions, this._deliveryQueue));
public readonly onContextMenu: Event<editorBrowser.IEditorMouseEvent> = this._onContextMenu.event;
private readonly _onMouseMove: Emitter<editorBrowser.IEditorMouseEvent> = this._register(new InteractionEmitter<editorBrowser.IEditorMouseEvent>(this._contributions2, this._deliveryQueue));
private readonly _onMouseMove: Emitter<editorBrowser.IEditorMouseEvent> = this._register(new InteractionEmitter<editorBrowser.IEditorMouseEvent>(this._contributions, this._deliveryQueue));
public readonly onMouseMove: Event<editorBrowser.IEditorMouseEvent> = this._onMouseMove.event;
private readonly _onMouseLeave: Emitter<editorBrowser.IPartialEditorMouseEvent> = this._register(new InteractionEmitter<editorBrowser.IPartialEditorMouseEvent>(this._contributions2, this._deliveryQueue));
private readonly _onMouseLeave: Emitter<editorBrowser.IPartialEditorMouseEvent> = this._register(new InteractionEmitter<editorBrowser.IPartialEditorMouseEvent>(this._contributions, this._deliveryQueue));
public readonly onMouseLeave: Event<editorBrowser.IPartialEditorMouseEvent> = this._onMouseLeave.event;
private readonly _onMouseWheel: Emitter<IMouseWheelEvent> = this._register(new InteractionEmitter<IMouseWheelEvent>(this._contributions2, this._deliveryQueue));
private readonly _onMouseWheel: Emitter<IMouseWheelEvent> = this._register(new InteractionEmitter<IMouseWheelEvent>(this._contributions, this._deliveryQueue));
public readonly onMouseWheel: Event<IMouseWheelEvent> = this._onMouseWheel.event;
private readonly _onKeyUp: Emitter<IKeyboardEvent> = this._register(new InteractionEmitter<IKeyboardEvent>(this._contributions2, this._deliveryQueue));
private readonly _onKeyUp: Emitter<IKeyboardEvent> = this._register(new InteractionEmitter<IKeyboardEvent>(this._contributions, this._deliveryQueue));
public readonly onKeyUp: Event<IKeyboardEvent> = this._onKeyUp.event;
private readonly _onKeyDown: Emitter<IKeyboardEvent> = this._register(new InteractionEmitter<IKeyboardEvent>(this._contributions2, this._deliveryQueue));
private readonly _onKeyDown: Emitter<IKeyboardEvent> = this._register(new InteractionEmitter<IKeyboardEvent>(this._contributions, this._deliveryQueue));
public readonly onKeyDown: Event<IKeyboardEvent> = this._onKeyDown.event;
private readonly _onDidContentSizeChange: Emitter<editorCommon.IContentSizeChangedEvent> = this._register(new Emitter<editorCommon.IContentSizeChangedEvent>({ deliveryQueue: this._deliveryQueue }));
@@ -332,7 +332,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
} else {
contributions = EditorExtensionsRegistry.getEditorContributions();
}
this._contributions2.initialize(this, contributions, this._instantiationService);
this._contributions.initialize(this, contributions, this._instantiationService);
for (const action of EditorExtensionsRegistry.getEditorActions()) {
if (this._actions.has(action.id)) {
@@ -512,7 +512,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
this._onDidChangeModel.fire(e);
this._postDetachModelCleanup(detachedModel);
this._contributions2.onAfterModelAttached();
this._contributions.onAfterModelAttached();
}
private _removeDecorationTypes(): void {
@@ -979,7 +979,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
if (!this._modelData) {
return null;
}
const contributionsState = this._contributions2.saveViewState();
const contributionsState = this._contributions.saveViewState();
const cursorState = this._modelData.viewModel.saveCursorState();
const viewState = this._modelData.viewModel.saveState();
return {
@@ -1005,7 +1005,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
this._modelData.viewModel.restoreCursorState([<editorCommon.ICursorState>cursorState]);
}
this._contributions2.restoreViewState(codeEditorState.contributionsState || {});
this._contributions.restoreViewState(codeEditorState.contributionsState || {});
const reducedState = this._modelData.viewModel.reduceRestoreState(codeEditorState.viewState);
this._modelData.view.restoreState(reducedState);
}
@@ -1021,7 +1021,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
}
public getContribution<T extends editorCommon.IEditorContribution>(id: string): T | null {
return this._contributions2.get(id) as T | null;
return this._contributions.get(id) as T | null;
}
public getActions(): editorCommon.IEditorAction[] {

View File

@@ -87,7 +87,7 @@ export class TestCodeEditor extends CodeEditorWidget implements ICodeEditor {
}
public registerAndInstantiateContribution<T extends IEditorContribution>(id: string, ctor: new (editor: ICodeEditor, ...services: BrandedService[]) => T): T {
const r: T = this._instantiationService.createInstance(ctor, this);
this._contributions2.set(id, r);
this._contributions.set(id, r);
return r;
}
public registerDisposable(disposable: IDisposable): void {