File tree Expand file tree Collapse file tree 5 files changed +35
-1
lines changed
packages/jupyterlab-lsp/src Expand file tree Collapse file tree 5 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,14 @@ Works When Kernel Is Shut Down
39
39
# this comes from kernel:
40
40
Completer Should Not Suggest %%timeit
41
41
42
+ Works In File Editor
43
+ Prepare File for Editing Python completion completion.py
44
+ Place Cursor In File Editor At 9 2
45
+ Capture Page Screenshot 01-editor-ready.png
46
+ Trigger Completer
47
+ Completer Should Suggest add
48
+ [Teardown] Clean Up After Working With File completion.py
49
+
42
50
Autocompletes If Only One Option
43
51
Enter Cell Editor 3 line=1
44
52
Press Keys None cle
Original file line number Diff line number Diff line change @@ -263,6 +263,15 @@ Place Cursor In Cell Editor At
263
263
Enter Cell Editor ${cell_nr } ${line }
264
264
Execute JavaScript return document.querySelector('.jp-Cell:nth-child(${cell_nr } ) .CodeMirror').CodeMirror.setCursor({line: ${line } - 1 , ch: ${character } })
265
265
266
+ Enter File Editor
267
+ Click Element css:.jp-FileEditor .CodeMirror
268
+ Wait Until Page Contains Element css:.jp-FileEditor .CodeMirror-focused
269
+
270
+ Place Cursor In File Editor At
271
+ [Arguments] ${line } ${character }
272
+ Enter File Editor
273
+ Execute JavaScript return document.querySelector('.jp-FileEditor .CodeMirror').CodeMirror.setCursor({line: ${line } - 1 , ch: ${character } })
274
+
266
275
Wait Until Fully Initialized
267
276
Wait Until Element Contains ${STATUSBAR } Fully initialized timeout=60s
268
277
Original file line number Diff line number Diff line change
1
+ addition = ''
2
+
3
+
4
+ def add (a : int , b : int ):
5
+ """Adds a and b together"""
6
+ return a , b
7
+
8
+
9
+ ad
Original file line number Diff line number Diff line change @@ -87,6 +87,7 @@ export abstract class WidgetAdapter<T extends IDocumentWidget> {
87
87
EditorAdapter < IVirtualEditor < IEditor > >
88
88
> ;
89
89
public adapterConnected : Signal < WidgetAdapter < T > , IDocumentConnectionData > ;
90
+ public isConnected : boolean ;
90
91
public connection_manager : DocumentConnectionManager ;
91
92
public status_message : StatusMessage ;
92
93
protected isDisposed = false ;
@@ -117,6 +118,7 @@ export abstract class WidgetAdapter<T extends IDocumentWidget> {
117
118
this . activeEditorChanged = new Signal ( this ) ;
118
119
this . adapters = new Map ( ) ;
119
120
this . status_message = new StatusMessage ( ) ;
121
+ this . isConnected = false ;
120
122
121
123
// set up signal connections
122
124
this . widget . context . saveState . connect ( this . on_save_state , this ) ;
@@ -268,6 +270,7 @@ export abstract class WidgetAdapter<T extends IDocumentWidget> {
268
270
269
271
this . connect_adapter ( data . virtual_document , data . connection ) ;
270
272
this . adapterConnected . emit ( data ) ;
273
+ this . isConnected = true ;
271
274
272
275
await this . update_documents ( ) . then ( ( ) => {
273
276
// refresh the document on the LSP server
Original file line number Diff line number Diff line change @@ -85,6 +85,7 @@ export class CompletionLabIntegration implements IFeatureLabIntegration {
85
85
manager : ILSPAdapterManager ,
86
86
adapter : WidgetAdapter < IDocumentWidget >
87
87
) {
88
+ console . log ( 'ADAPTER CHANGED TO ' , adapter ) ;
88
89
if ( this . current_adapter ) {
89
90
// disconnect signals from the old adapter
90
91
this . current_adapter . activeEditorChanged . disconnect (
@@ -97,13 +98,17 @@ export class CompletionLabIntegration implements IFeatureLabIntegration {
97
98
) ;
98
99
}
99
100
this . current_adapter = adapter ;
101
+ // connect the new adapter
102
+ if ( this . current_adapter . isConnected ) {
103
+ this . connect_completion ( this . current_adapter ) ;
104
+ this . set_connector ( adapter , { editor : adapter . activeEditor } ) ;
105
+ }
100
106
// connect signals to the new adapter
101
107
this . current_adapter . activeEditorChanged . connect ( this . set_connector , this ) ;
102
108
this . current_adapter . adapterConnected . connect (
103
109
this . connect_completion ,
104
110
this
105
111
) ;
106
- this . set_connector ( adapter , { editor : adapter . activeEditor } ) ;
107
112
}
108
113
109
114
connect_completion (
You can’t perform that action at this time.
0 commit comments