File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
packages/language-server/src Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -8,8 +8,8 @@ export class DiagnosticsManager {
88 constructor (
99 private sendDiagnostics : SendDiagnostics ,
1010 private docManager : DocumentManager ,
11- private getDiagnostics : GetDiagnostics
12- ) { }
11+ private getDiagnostics : GetDiagnostics ,
12+ ) { }
1313
1414 updateAll ( ) {
1515 this . docManager . getAllOpenedByClient ( ) . forEach ( ( doc ) => {
@@ -24,4 +24,11 @@ export class DiagnosticsManager {
2424 diagnostics,
2525 } ) ;
2626 }
27+
28+ removeDiagnostics ( document : Document ) {
29+ this . sendDiagnostics ( {
30+ uri : document . getURL ( ) ,
31+ diagnostics : [ ] ,
32+ } ) ;
33+ }
2734}
Original file line number Diff line number Diff line change @@ -259,6 +259,9 @@ export function startServer(options?: LSOptions) {
259259 'documentChange' ,
260260 _ . debounce ( async ( document : Document ) => diagnosticsManager . update ( document ) , 500 ) ,
261261 ) ;
262+ docManager . on ( 'documentClose' , ( document : Document ) =>
263+ diagnosticsManager . removeDiagnostics ( document ) ,
264+ ) ;
262265
263266 // The language server protocol does not have a specific "did rename/move files" event,
264267 // so we create our own in the extension client and handle it here
You can’t perform that action at this time.
0 commit comments