@@ -89,11 +89,11 @@ export class NotebookAdapter extends JupyterLabWidgetAdapter {
89
89
this
90
90
) ;
91
91
this . widget . content . activeCellChanged . disconnect ( this . on_completions , this ) ;
92
- for ( const handler of this . completion_handlers . values ( ) ) {
93
- handler . connector = null ;
94
- handler . editor = null ;
92
+ if ( this . current_completion_handler ) {
93
+ this . current_completion_handler . connector = null ;
94
+ this . current_completion_handler . editor = null ;
95
+ this . current_completion_handler = null ;
95
96
}
96
- this . completion_handlers . clear ( ) ;
97
97
super . dispose ( ) ;
98
98
}
99
99
@@ -175,10 +175,7 @@ export class NotebookAdapter extends JupyterLabWidgetAdapter {
175
175
} ) ;
176
176
}
177
177
178
- completion_handlers = new Map <
179
- Cell ,
180
- ICompletionManager . ICompletableAttributes
181
- > ( ) ;
178
+ current_completion_handler : ICompletionManager . ICompletableAttributes ;
182
179
183
180
connect_completion ( ) {
184
181
// see https://github.com/jupyterlab/jupyterlab/blob/c0e9eb94668832d1208ad3b00a9791ef181eca4c/packages/completer-extension/src/index.ts#L198-L213
@@ -192,19 +189,20 @@ export class NotebookAdapter extends JupyterLabWidgetAdapter {
192
189
editor : cell . editor ,
193
190
parent : this . widget
194
191
} ) ;
195
- this . completion_handlers . set ( cell , handler ) ;
192
+ this . current_completion_handler = handler ;
193
+ this . widget . content . activeCellChanged . connect ( this . on_completions , this ) ;
196
194
}
197
195
198
196
on_completions ( notebook : Notebook , cell : Cell ) {
199
197
if ( cell == null ) {
200
198
return ;
201
199
}
200
+ console . error (
201
+ 'NRB: on_completions' ,
202
+ ( cell . editor as any ) . _editor . display . lineDiv
203
+ ) ;
202
204
this . set_completion_connector ( cell ) ;
203
- const handler = this . completion_handlers . get ( cell ) ;
204
- if ( handler == null ) {
205
- return ;
206
- }
207
- handler . editor = cell . editor ;
208
- handler . connector = this . current_completion_connector ;
205
+ this . current_completion_handler . editor = cell . editor ;
206
+ this . current_completion_handler . connector = this . current_completion_connector ;
209
207
}
210
208
}
0 commit comments