@@ -14,6 +14,7 @@ import type {
14
14
NotebookEditor ,
15
15
NotebookKernel ,
16
16
NotebookKernelProvider ,
17
+ window ,
17
18
} from 'vscode-proposed' ;
18
19
import { UseProposedApi } from '../constants' ;
19
20
import { IDisposableRegistry } from '../types' ;
@@ -34,7 +35,7 @@ export class VSCodeNotebook implements IVSCodeNotebook {
34
35
}
35
36
public get onDidChangeActiveNotebookEditor ( ) : Event < NotebookEditor | undefined > {
36
37
return this . canUseNotebookApi
37
- ? this . notebook . onDidChangeActiveNotebookEditor
38
+ ? this . window . onDidChangeActiveNotebookEditor
38
39
: new EventEmitter < NotebookEditor | undefined > ( ) . event ;
39
40
}
40
41
public get onDidOpenNotebookDocument ( ) : Event < NotebookDocument > {
@@ -56,7 +57,7 @@ export class VSCodeNotebook implements IVSCodeNotebook {
56
57
return this . canUseNotebookApi ? this . notebook . notebookDocuments : [ ] ;
57
58
}
58
59
public get notebookEditors ( ) {
59
- return this . canUseNotebookApi ? this . notebook . visibleNotebookEditors : [ ] ;
60
+ return this . canUseNotebookApi ? this . window . visibleNotebookEditors : [ ] ;
60
61
}
61
62
public get onDidChangeNotebookDocument ( ) : Event < NotebookCellChangedEvent > {
62
63
return this . canUseNotebookApi
@@ -67,17 +68,24 @@ export class VSCodeNotebook implements IVSCodeNotebook {
67
68
if ( ! this . useProposedApi ) {
68
69
return ;
69
70
}
70
- return this . notebook . activeNotebookEditor ;
71
+ return this . window . activeNotebookEditor ;
71
72
}
72
73
private get notebook ( ) {
73
74
if ( ! this . _notebook ) {
74
75
this . _notebook = require ( 'vscode' ) . notebook ;
75
76
}
76
77
return this . _notebook ! ;
77
78
}
79
+ private get window ( ) {
80
+ if ( ! this . _window ) {
81
+ this . _window = require ( 'vscode' ) . window ;
82
+ }
83
+ return this . _window ! ;
84
+ }
78
85
private readonly _onDidChangeNotebookDocument = new EventEmitter < NotebookCellChangedEvent > ( ) ;
79
86
private addedEventHandlers ?: boolean ;
80
87
private _notebook ?: typeof notebook ;
88
+ private _window ?: typeof window ;
81
89
private readonly canUseNotebookApi ?: boolean ;
82
90
private readonly handledCellChanges = new WeakSet < VSCNotebookCellsChangeEvent > ( ) ;
83
91
constructor (
0 commit comments