@@ -413,7 +413,7 @@ protected Task HandleDidOpenTextDocumentNotification(
413
413
return Task . FromResult ( true ) ;
414
414
}
415
415
416
- protected Task HandleDidCloseTextDocumentNotification (
416
+ protected async Task HandleDidCloseTextDocumentNotification (
417
417
TextDocumentIdentifier closeParams ,
418
418
EventContext eventContext )
419
419
{
@@ -423,11 +423,10 @@ protected Task HandleDidCloseTextDocumentNotification(
423
423
if ( fileToClose != null )
424
424
{
425
425
editorSession . Workspace . CloseFile ( fileToClose ) ;
426
+ await ClearMarkers ( fileToClose , eventContext ) ;
426
427
}
427
428
428
429
Logger . Write ( LogLevel . Verbose , "Finished closing document." ) ;
429
-
430
- return Task . FromResult ( true ) ;
431
430
}
432
431
433
432
protected Task HandleDidChangeTextDocumentNotification (
@@ -496,15 +495,9 @@ protected async Task HandleDidChangeConfigurationNotification(
496
495
// event to clear the analysis markers that they already have.
497
496
if ( ! this . currentSettings . ScriptAnalysis . Enable . Value || settingsPathChanged )
498
497
{
499
- ScriptFileMarker [ ] emptyAnalysisDiagnostics = new ScriptFileMarker [ 0 ] ;
500
-
501
498
foreach ( var scriptFile in editorSession . Workspace . GetOpenedFiles ( ) )
502
499
{
503
- await PublishScriptDiagnostics (
504
- scriptFile ,
505
- emptyAnalysisDiagnostics ,
506
- this . codeActionsPerFile ,
507
- eventContext ) ;
500
+ await ClearMarkers ( scriptFile , eventContext ) ;
508
501
}
509
502
}
510
503
@@ -1215,6 +1208,16 @@ await PublishScriptDiagnostics(
1215
1208
}
1216
1209
}
1217
1210
1211
+ private async Task ClearMarkers ( ScriptFile scriptFile , EventContext eventContext )
1212
+ {
1213
+ // send empty diagnostic markers to clear any markers associated with the given file
1214
+ await PublishScriptDiagnostics (
1215
+ scriptFile ,
1216
+ new ScriptFileMarker [ 0 ] ,
1217
+ this . codeActionsPerFile ,
1218
+ eventContext ) ;
1219
+ }
1220
+
1218
1221
private static async Task PublishScriptDiagnostics (
1219
1222
ScriptFile scriptFile ,
1220
1223
ScriptFileMarker [ ] semanticMarkers ,
0 commit comments