File tree Expand file tree Collapse file tree 5 files changed +35
-2
lines changed
packages/jupyterlab-lsp/src Expand file tree Collapse file tree 5 files changed +35
-2
lines changed Original file line number Diff line number Diff line change 15
15
- user-invoked completion in strings works again ([ #521 ] )
16
16
- completer documentation will now consistently show up after filtering the completion items ([ #520 ] )
17
17
- completions containing HTML-like syntax will be displayed properly (an upstream issue) ([ #520 ] )
18
+ - diagnostics panel will no longer break when foreign documents (e.g. ` %%R ` cell magics) are removed ([ #522 ] )
18
19
19
20
[ #520 ] : https://github.com/krassowski/jupyterlab-lsp/pull/520
20
21
[ #521 ] : https://github.com/krassowski/jupyterlab-lsp/pull/521
22
+ [ #522 ] : https://github.com/krassowski/jupyterlab-lsp/pull/522
21
23
22
24
### ` @krassowski/jupyterlab-lsp 3.3.1 ` (2020-02-07)
23
25
Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ Test Teardown Clean Up
9
9
${EXPECTED_COUNT } 1
10
10
${DIAGNOSTIC } W291 trailing whitespace (pycodestyle)
11
11
${DIAGNOSTIC MESSAGE } trailing whitespace
12
+ ${DIAGNOSTIC MESSAGE R } Closing curly-braces should always be on their own line
13
+ ${R CELL } %%R\n{}
12
14
${MENU COLUMNS } xpath://div[contains(@class, 'lm-Menu-itemLabel')][contains(text(), "columns")]
13
15
${LAB MENU } css:.lm-Menu
14
16
@@ -78,6 +80,22 @@ Diagnostic Message Can Be Copied
78
80
Close Diagnostics Panel
79
81
Wait Until Element Contains css:.lsp-statusbar-item Successfully copied timeout=10s
80
82
83
+ Diagnostics Panel Works After Removing Foreign Document
84
+ Enter Cell Editor 2
85
+ Lab Command Insert Cell Below
86
+ Enter Cell Editor 3
87
+ Press Keys None ${R CELL }
88
+ Wait Until Keyword Succeeds 10 x 1s Element Should Contain ${DIAGNOSTICS PANEL } ${DIAGNOSTIC MESSAGE }
89
+ Wait Until Keyword Succeeds 10 x 1s Element Should Contain ${DIAGNOSTICS PANEL } ${DIAGNOSTIC MESSAGE R }
90
+ Lab Command Delete Cells
91
+ # regain focus by entering cell
92
+ Enter Cell Editor 2
93
+ # trigger 7 document updates to trigger the garbage collector that removes unused documents
94
+ # (search for VirtualDocument.remainining_lifetime for more)
95
+ Press Keys None 1234567
96
+ Wait Until Keyword Succeeds 10 x 1s Element Should Contain ${DIAGNOSTICS PANEL } ${DIAGNOSTIC MESSAGE }
97
+ Wait Until Keyword Succeeds 10 x 1s Element Should Not Contain ${DIAGNOSTICS PANEL } ${DIAGNOSTIC MESSAGE R }
98
+
81
99
*** Keywords ***
82
100
Expand Menu Entry
83
101
[Arguments] ${label }
Original file line number Diff line number Diff line change @@ -65,7 +65,11 @@ export function DocumentLocator(props: {
65
65
let target : HTMLElement = null ;
66
66
if ( adapter . has_multiple_editors ) {
67
67
let first_line = document . virtual_lines . get ( 0 ) ;
68
- target = adapter . get_editor_wrapper ( first_line . editor ) ;
68
+ if ( first_line ) {
69
+ target = adapter . get_editor_wrapper ( first_line . editor ) ;
70
+ } else {
71
+ console . warn ( 'Could not get first line of ' , document ) ;
72
+ }
69
73
}
70
74
let breadcrumbs = get_breadcrumbs ( document , adapter ) ;
71
75
return (
Original file line number Diff line number Diff line change @@ -279,9 +279,18 @@ export class DiagnosticsCM extends CodeMirrorIntegration {
279
279
this . adapter . adapterConnected . connect ( ( ) =>
280
280
this . switchDiagnosticsPanelSource ( )
281
281
) ;
282
+ this . virtual_document . foreign_document_closed . connect (
283
+ ( document , context ) => {
284
+ this . clearDocumentDiagnostics ( context . foreign_document ) ;
285
+ }
286
+ ) ;
282
287
super . register ( ) ;
283
288
}
284
289
290
+ clearDocumentDiagnostics ( document : VirtualDocument ) {
291
+ this . diagnostics_db . set ( document , [ ] ) ;
292
+ }
293
+
285
294
private unique_editor_ids : DefaultMap < CodeMirror . Editor , number > ;
286
295
private marked_diagnostics : Map < string , CodeMirror . TextMarker > = new Map ( ) ;
287
296
/**
Original file line number Diff line number Diff line change @@ -252,7 +252,7 @@ export class VirtualDocument {
252
252
this . unused_standalone_documents = new DefaultMap (
253
253
( ) => new Array < VirtualDocument > ( )
254
254
) ;
255
- this . _remaining_lifetime = 10 ;
255
+ this . _remaining_lifetime = 6 ;
256
256
this . foreign_document_closed = new Signal ( this ) ;
257
257
this . foreign_document_opened = new Signal ( this ) ;
258
258
this . changed = new Signal ( this ) ;
You can’t perform that action at this time.
0 commit comments