diff --git a/src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts b/src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts index b147b50320c..0187302710b 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts @@ -427,6 +427,16 @@ export interface INotebookEditor extends ICommonNotebookEditor { readonly onDidChangeViewCells: Event; readonly onDidChangeVisibleRanges: Event; readonly onDidChangeSelection: Event; + /** + * An event emitted when the model of this editor has changed. + * @event + */ + readonly onDidChangeModel: Event; + readonly onDidFocusEditorWidget: Event; + readonly onDidScroll: Event; + readonly onDidChangeActiveCell: Event; + readonly onMouseUp: Event; + readonly onMouseDown: Event; //#endregion @@ -449,16 +459,6 @@ export interface INotebookEditor extends ICommonNotebookEditor { _getViewModel(): NotebookViewModel | undefined; hasModel(): this is IActiveNotebookEditor; - - /** - * An event emitted when the model of this editor has changed. - * @event - */ - readonly onDidChangeModel: Event; - readonly onDidFocusEditorWidget: Event; - readonly onDidScroll: Event; - - readonly onDidChangeActiveCell: Event; readonly notebookOptions: NotebookOptions; isDisposed: boolean; dispose(): void; @@ -695,18 +695,6 @@ export interface INotebookEditor extends ICommonNotebookEditor { setEditorDecorations(key: string, range: ICellRange): void; removeEditorDecorations(key: string): void; - /** - * An event emitted on a "mouseup". - * @event - */ - onMouseUp(listener: (e: INotebookEditorMouseEvent) => void): IDisposable; - - /** - * An event emitted on a "mousedown". - * @event - */ - onMouseDown(listener: (e: INotebookEditorMouseEvent) => void): IDisposable; - /** * Get a contribution of this editor. * @id Unique identifier of the contribution. diff --git a/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts b/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts index b2ae9a2d458..91a3df47bf9 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts @@ -219,9 +219,32 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor //#region Eventing private readonly _onDidChangeCellState = this._register(new Emitter()); readonly onDidChangeCellState = this._onDidChangeCellState.event; - private readonly _onDidChangeViewCells = this._register(new Emitter()); - onDidChangeViewCells: Event = this._onDidChangeViewCells.event; + readonly onDidChangeViewCells: Event = this._onDidChangeViewCells.event; + private readonly _onDidChangeModel = this._register(new Emitter()); + readonly onDidChangeModel: Event = this._onDidChangeModel.event; + private readonly _onDidChangeOptions = this._register(new Emitter()); + readonly onDidChangeOptions: Event = this._onDidChangeOptions.event; + private readonly _onDidScroll = this._register(new Emitter()); + readonly onDidScroll: Event = this._onDidScroll.event; + private readonly _onDidChangeActiveCell = this._register(new Emitter()); + readonly onDidChangeActiveCell: Event = this._onDidChangeActiveCell.event; + private readonly _onDidChangeSelection = this._register(new Emitter()); + readonly onDidChangeSelection: Event = this._onDidChangeSelection.event; + private readonly _onDidChangeVisibleRanges = this._register(new Emitter()); + readonly onDidChangeVisibleRanges: Event = this._onDidChangeVisibleRanges.event; + private readonly _onDidFocusEditorWidget = this._register(new Emitter()); + readonly onDidFocusEditorWidget = this._onDidFocusEditorWidget.event; + private readonly _onDidFocusEmitter = this._register(new Emitter()); + readonly onDidFocus = this._onDidFocusEmitter.event; + private readonly _onDidBlurEmitter = this._register(new Emitter()); + readonly onDidBlur = this._onDidBlurEmitter.event; + private readonly _onDidChangeActiveEditor = this._register(new Emitter()); + readonly onDidChangeActiveEditor: Event = this._onDidChangeActiveEditor.event; + private readonly _onMouseUp: Emitter = this._register(new Emitter()); + readonly onMouseUp: Event = this._onMouseUp.event; + private readonly _onMouseDown: Emitter = this._register(new Emitter()); + readonly onMouseDown: Event = this._onMouseDown.event; //#endregion private _overlayContainer!: HTMLElement; @@ -254,10 +277,6 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor private _outputRenderer: OutputRenderer; protected readonly _contributions = new Map(); private _scrollBeyondLastLine: boolean; - private readonly _onDidFocusEmitter = this._register(new Emitter()); - public readonly onDidFocus = this._onDidFocusEmitter.event; - private readonly _onDidBlurEmitter = this._register(new Emitter()); - public readonly onDidBlur = this._onDidBlurEmitter.event; private readonly _insetModifyQueueByOutputId = new SequencerByKey(); private _kernelManger: NotebookEditorKernelManager; private _cellContextKeyManager: CellContextKeyManager | null = null; @@ -271,12 +290,6 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor return this._isDisposed; } - private readonly _onDidChangeModel = this._register(new Emitter()); - readonly onDidChangeModel: Event = this._onDidChangeModel.event; - - private readonly _onDidFocusEditorWidget = this._register(new Emitter()); - readonly onDidFocusEditorWidget = this._onDidFocusEditorWidget.event; - set viewModel(newModel: NotebookViewModel | undefined) { this._notebookViewModel = newModel; this._onDidChangeModel.fire(newModel?.notebookDocument); @@ -294,9 +307,6 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor return this._notebookViewModel?.options.isReadOnly ?? false; } - private readonly _onDidChangeActiveEditor = this._register(new Emitter()); - readonly onDidChangeActiveEditor: Event = this._onDidChangeActiveEditor.event; - get activeCodeEditor(): IEditor | undefined { if (this._isDisposed) { return; @@ -306,10 +316,6 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor return this._renderedEditors.get(focused); } - private readonly _onDidScroll = this._register(new Emitter()); - readonly onDidScroll: Event = this._onDidScroll.event; - private readonly _onDidChangeActiveCell = this._register(new Emitter()); - readonly onDidChangeActiveCell: Event = this._onDidChangeActiveCell.event; private _cursorNavigationMode: boolean = false; get cursorNavigationMode(): boolean { return this._cursorNavigationMode; @@ -319,11 +325,6 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor this._cursorNavigationMode = v; } - private readonly _onDidChangeSelection = this._register(new Emitter()); - get onDidChangeSelection(): Event { return this._onDidChangeSelection.event; } - - private readonly _onDidChangeVisibleRanges = this._register(new Emitter()); - onDidChangeVisibleRanges: Event = this._onDidChangeVisibleRanges.event; get visibleRanges() { return this._list.visibleRanges || []; @@ -340,9 +341,6 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor return this._notebookOptions; } - private readonly _onDidChangeOptions = this._register(new Emitter()); - get onDidChangeOptions(): Event { return this._onDidChangeOptions.event; } - constructor( readonly creationOptions: INotebookEditorCreationOptions, @IInstantiationService instantiationService: IInstantiationService, @@ -1926,15 +1924,6 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor //#endregion - //#region Mouse Events - private readonly _onMouseUp: Emitter = this._register(new Emitter()); - public readonly onMouseUp: Event = this._onMouseUp.event; - - private readonly _onMouseDown: Emitter = this._register(new Emitter()); - public readonly onMouseDown: Event = this._onMouseDown.event; - - //#endregion - //#region Kernel/Execution private async _loadKernelPreloads(): Promise {