File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
packages/jupyterlab-lsp/src/features/diagnostics Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -275,10 +275,6 @@ export class DiagnosticsCM extends CodeMirrorIntegration {
275
275
this . connection_handlers . set ( 'diagnostic' , this . handleDiagnostic ) ;
276
276
this . wrapper_handlers . set ( 'focusin' , this . switchDiagnosticsPanelSource ) ;
277
277
this . unique_editor_ids = new DefaultMap ( ( ) => this . unique_editor_ids . size ) ;
278
- if ( ! diagnostics_databases . has ( this . virtual_editor ) ) {
279
- diagnostics_databases . set ( this . virtual_editor , new DiagnosticsDatabase ( ) ) ;
280
- }
281
- this . diagnostics_db = diagnostics_databases . get ( this . virtual_editor ) ;
282
278
this . settings . changed . connect ( this . refreshDiagnostics , this ) ;
283
279
super . register ( ) ;
284
280
}
@@ -294,7 +290,13 @@ export class DiagnosticsCM extends CodeMirrorIntegration {
294
290
*
295
291
* Maps virtual_document.uri to IEditorDiagnostic[].
296
292
*/
297
- public diagnostics_db : DiagnosticsDatabase ;
293
+ public get diagnostics_db ( ) : DiagnosticsDatabase {
294
+ // Note that virtual_editor can change at runtime (kernel restart)
295
+ if ( ! diagnostics_databases . has ( this . virtual_editor ) ) {
296
+ diagnostics_databases . set ( this . virtual_editor , new DiagnosticsDatabase ( ) ) ;
297
+ }
298
+ return diagnostics_databases . get ( this . virtual_editor ) ;
299
+ }
298
300
299
301
switchDiagnosticsPanelSource = ( ) => {
300
302
if (
You can’t perform that action at this time.
0 commit comments