@@ -14,6 +14,7 @@ import type {
1414 NotebookEditor ,
1515 NotebookKernel ,
1616 NotebookKernelProvider ,
17+ window ,
1718} from 'vscode-proposed' ;
1819import { UseProposedApi } from '../constants' ;
1920import { IDisposableRegistry } from '../types' ;
@@ -34,7 +35,7 @@ export class VSCodeNotebook implements IVSCodeNotebook {
3435 }
3536 public get onDidChangeActiveNotebookEditor ( ) : Event < NotebookEditor | undefined > {
3637 return this . canUseNotebookApi
37- ? this . notebook . onDidChangeActiveNotebookEditor
38+ ? this . window . onDidChangeActiveNotebookEditor
3839 : new EventEmitter < NotebookEditor | undefined > ( ) . event ;
3940 }
4041 public get onDidOpenNotebookDocument ( ) : Event < NotebookDocument > {
@@ -56,7 +57,7 @@ export class VSCodeNotebook implements IVSCodeNotebook {
5657 return this . canUseNotebookApi ? this . notebook . notebookDocuments : [ ] ;
5758 }
5859 public get notebookEditors ( ) {
59- return this . canUseNotebookApi ? this . notebook . visibleNotebookEditors : [ ] ;
60+ return this . canUseNotebookApi ? this . window . visibleNotebookEditors : [ ] ;
6061 }
6162 public get onDidChangeNotebookDocument ( ) : Event < NotebookCellChangedEvent > {
6263 return this . canUseNotebookApi
@@ -67,17 +68,24 @@ export class VSCodeNotebook implements IVSCodeNotebook {
6768 if ( ! this . useProposedApi ) {
6869 return ;
6970 }
70- return this . notebook . activeNotebookEditor ;
71+ return this . window . activeNotebookEditor ;
7172 }
7273 private get notebook ( ) {
7374 if ( ! this . _notebook ) {
7475 this . _notebook = require ( 'vscode' ) . notebook ;
7576 }
7677 return this . _notebook ! ;
7778 }
79+ private get window ( ) {
80+ if ( ! this . _window ) {
81+ this . _window = require ( 'vscode' ) . window ;
82+ }
83+ return this . _window ! ;
84+ }
7885 private readonly _onDidChangeNotebookDocument = new EventEmitter < NotebookCellChangedEvent > ( ) ;
7986 private addedEventHandlers ?: boolean ;
8087 private _notebook ?: typeof notebook ;
88+ private _window ?: typeof window ;
8189 private readonly canUseNotebookApi ?: boolean ;
8290 private readonly handledCellChanges = new WeakSet < VSCNotebookCellsChangeEvent > ( ) ;
8391 constructor (
0 commit comments