@@ -90,15 +90,16 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
90
90
private editorExecutingNotebook : IContextKey < boolean > | null = null ;
91
91
private notebookHasMultipleKernels : IContextKey < boolean > | null = null ;
92
92
private outputRenderer : OutputRenderer ;
93
- protected readonly _contributions : { [ key : string ] : INotebookEditorContribution ; } ;
93
+ protected readonly contributions : { [ key : string ] : INotebookEditorContribution ; } ;
94
94
private scrollBeyondLastLine : boolean ;
95
95
private readonly memento : Memento ;
96
+ private readonly onDidFocusEmitter = this . _register ( new Emitter < void > ( ) ) ;
97
+ public readonly onDidFocus = this . onDidFocusEmitter . event ;
98
+ private cellContextKeyManager : CellContextKeyManager | null = null ;
99
+ private isVisible = false ;
100
+ private readonly uuid = generateUuid ( ) ;
101
+
96
102
private _isDisposed : boolean = false ;
97
- private readonly _onDidFocusWidget = this . _register ( new Emitter < void > ( ) ) ;
98
- public get onDidFocus ( ) : Event < any > { return this . _onDidFocusWidget . event ; }
99
- private _cellContextKeyManager : CellContextKeyManager | null = null ;
100
- private _isVisible = false ;
101
- private readonly _uuid = generateUuid ( ) ;
102
103
103
104
get isDisposed ( ) {
104
105
return this . _isDisposed ;
@@ -110,19 +111,19 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
110
111
@INotebookService private notebookService : INotebookService ,
111
112
@IConfigurationService private readonly configurationService : IConfigurationService ,
112
113
@IContextKeyService readonly contextKeyService : IContextKeyService ,
113
- @ILayoutService private readonly _layoutService : ILayoutService
114
+ @ILayoutService private readonly layoutService : ILayoutService
114
115
) {
115
116
super ( ) ;
116
117
this . memento = new Memento ( NotebookEditorWidget . ID , storageService ) ;
117
118
118
119
this . outputRenderer = new OutputRenderer ( this , this . instantiationService ) ;
119
- this . _contributions = { } ;
120
+ this . contributions = { } ;
120
121
this . scrollBeyondLastLine = this . configurationService . getValue < boolean > ( 'editor.scrollBeyondLastLine' ) ;
121
122
122
123
this . configurationService . onDidChangeConfiguration ( e => {
123
124
if ( e . affectsConfiguration ( 'editor.scrollBeyondLastLine' ) ) {
124
125
this . scrollBeyondLastLine = this . configurationService . getValue < boolean > ( 'editor.scrollBeyondLastLine' ) ;
125
- if ( this . dimension && this . _isVisible ) {
126
+ if ( this . dimension && this . isVisible ) {
126
127
this . layout ( this . dimension ) ;
127
128
}
128
129
}
@@ -132,7 +133,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
132
133
}
133
134
134
135
public getId ( ) : string {
135
- return this . _uuid ;
136
+ return this . uuid ;
136
137
}
137
138
138
139
private readonly _onDidChangeModel = new Emitter < NotebookTextModel | undefined > ( ) ;
@@ -231,12 +232,12 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
231
232
DOM . addClass ( this . overlayContainer , 'notebook-editor' ) ;
232
233
this . overlayContainer . style . visibility = 'hidden' ;
233
234
234
- this . _layoutService . container . appendChild ( this . overlayContainer ) ;
235
+ this . layoutService . container . appendChild ( this . overlayContainer ) ;
235
236
this . createBody ( this . overlayContainer ) ;
236
237
this . generateFontInfo ( ) ;
237
238
this . editorFocus = NOTEBOOK_EDITOR_FOCUSED . bindTo ( this . contextKeyService ) ;
238
239
this . editorFocus . set ( true ) ;
239
- this . _isVisible = true ;
240
+ this . isVisible = true ;
240
241
this . outputFocus = NOTEBOOK_OUTPUT_FOCUSED . bindTo ( this . contextKeyService ) ;
241
242
this . editorEditable = NOTEBOOK_EDITOR_EDITABLE . bindTo ( this . contextKeyService ) ;
242
243
this . editorEditable . set ( true ) ;
@@ -251,7 +252,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
251
252
for ( const desc of contributions ) {
252
253
try {
253
254
const contribution = this . instantiationService . createInstance ( desc . ctor , this ) ;
254
- this . _contributions [ desc . id ] = contribution ;
255
+ this . contributions [ desc . id ] = contribution ;
255
256
} catch ( err ) {
256
257
onUnexpectedError ( err ) ;
257
258
}
@@ -364,15 +365,15 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
364
365
365
366
const widgetFocusTracker = DOM . trackFocus ( this . getDomNode ( ) ) ;
366
367
this . _register ( widgetFocusTracker ) ;
367
- this . _register ( widgetFocusTracker . onDidFocus ( ( ) => this . _onDidFocusWidget . fire ( ) ) ) ;
368
+ this . _register ( widgetFocusTracker . onDidFocus ( ( ) => this . onDidFocusEmitter . fire ( ) ) ) ;
368
369
}
369
370
370
371
getDomNode ( ) {
371
372
return this . overlayContainer ;
372
373
}
373
374
374
375
onWillHide ( ) {
375
- this . _isVisible = false ;
376
+ this . isVisible = false ;
376
377
this . editorFocus ?. set ( false ) ;
377
378
this . overlayContainer . style . visibility = 'hidden' ;
378
379
this . overlayContainer . style . left = '-50000px' ;
@@ -383,7 +384,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
383
384
}
384
385
385
386
focus ( ) {
386
- this . _isVisible = true ;
387
+ this . isVisible = true ;
387
388
this . editorFocus ?. set ( true ) ;
388
389
this . list ?. domFocus ( ) ;
389
390
this . _onDidFocusEditorWidget . fire ( ) ;
@@ -398,22 +399,22 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
398
399
// clear state
399
400
this . dndController ?. clearGlobalDragState ( ) ;
400
401
401
- this . _setKernels ( textModel ) ;
402
+ this . setKernels ( textModel ) ;
402
403
403
404
this . localStore . add ( this . notebookService . onDidChangeKernels ( ( ) => {
404
405
if ( this . activeKernel === undefined ) {
405
- this . _setKernels ( textModel ) ;
406
+ this . setKernels ( textModel ) ;
406
407
}
407
408
} ) ) ;
408
409
409
410
this . localStore . add ( this . list ! . onDidChangeFocus ( ( ) => {
410
411
const focused = this . list ! . getFocusedElements ( ) [ 0 ] ;
411
412
if ( focused ) {
412
- if ( ! this . _cellContextKeyManager ) {
413
- this . _cellContextKeyManager = this . localStore . add ( new CellContextKeyManager ( this . contextKeyService , textModel , focused as any ) ) ;
413
+ if ( ! this . cellContextKeyManager ) {
414
+ this . cellContextKeyManager = this . localStore . add ( new CellContextKeyManager ( this . contextKeyService , textModel , focused as any ) ) ;
414
415
}
415
416
416
- this . _cellContextKeyManager . updateForElement ( focused as any ) ;
417
+ this . cellContextKeyManager . updateForElement ( focused as any ) ;
417
418
}
418
419
} ) ) ;
419
420
@@ -472,7 +473,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
472
473
this . list ?. clear ( ) ;
473
474
}
474
475
475
- private _setKernels ( textModel : NotebookTextModel ) {
476
+ private setKernels ( textModel : NotebookTextModel ) {
476
477
const provider = this . notebookService . getContributedNotebookProviders ( this . viewModel ! . uri ) [ 0 ] ;
477
478
const availableKernels = this . notebookService . getContributedNotebookKernels ( textModel . viewType , textModel . uri ) ;
478
479
@@ -522,7 +523,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
522
523
this . webview . webview . onDidFocus ( ( ) => {
523
524
this . outputFocus ?. set ( true ) ;
524
525
this . updateEditorFocus ( ) ;
525
- this . _onDidFocusWidget . fire ( ) ;
526
+ this . onDidFocusEmitter . fire ( ) ;
526
527
} ) ;
527
528
528
529
this . localStore . add ( this . webview . onMessage ( message => {
@@ -553,10 +554,10 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
553
554
// contribution state restore
554
555
555
556
const contributionsState = viewState ?. contributionsState || { } ;
556
- const keys = Object . keys ( this . _contributions ) ;
557
+ const keys = Object . keys ( this . contributions ) ;
557
558
for ( let i = 0 , len = keys . length ; i < len ; i ++ ) {
558
559
const id = keys [ i ] ;
559
- const contribution = this . _contributions [ id ] ;
560
+ const contribution = this . contributions [ id ] ;
560
561
if ( typeof contribution . restoreViewState === 'function' ) {
561
562
contribution . restoreViewState ( contributionsState [ id ] ) ;
562
563
}
@@ -696,9 +697,9 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
696
697
// Save contribution view states
697
698
const contributionsState : { [ key : string ] : any } = { } ;
698
699
699
- const keys = Object . keys ( this . _contributions ) ;
700
+ const keys = Object . keys ( this . contributions ) ;
700
701
for ( const id of keys ) {
701
- const contribution = this . _contributions [ id ] ;
702
+ const contribution = this . contributions [ id ] ;
702
703
if ( typeof contribution . saveViewState === 'function' ) {
703
704
contributionsState [ id ] = contribution . saveViewState ( ) ;
704
705
}
@@ -1218,18 +1219,18 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
1218
1219
1219
1220
//#region Editor Contributions
1220
1221
public getContribution < T extends INotebookEditorContribution > ( id : string ) : T {
1221
- return < T > ( this . _contributions [ id ] || null ) ;
1222
+ return < T > ( this . contributions [ id ] || null ) ;
1222
1223
}
1223
1224
1224
1225
//#endregion
1225
1226
1226
1227
dispose ( ) {
1227
1228
this . _isDisposed = true ;
1228
1229
this . notebookService . removeNotebookEditor ( this ) ;
1229
- const keys = Object . keys ( this . _contributions ) ;
1230
+ const keys = Object . keys ( this . contributions ) ;
1230
1231
for ( let i = 0 , len = keys . length ; i < len ; i ++ ) {
1231
1232
const contributionId = keys [ i ] ;
1232
- this . _contributions [ contributionId ] . dispose ( ) ;
1233
+ this . contributions [ contributionId ] . dispose ( ) ;
1233
1234
}
1234
1235
1235
1236
this . localStore . clear ( ) ;
0 commit comments