@@ -633,11 +633,9 @@ impl GlobalState {
633
633
Ok ( ( ) )
634
634
} ) ?
635
635
. on :: < lsp_types:: notification:: DidCloseTextDocument > ( |this, params| {
636
- let mut version = None ;
637
636
if let Ok ( path) = from_proto:: vfs_path ( & params. text_document . uri ) {
638
- match this. mem_docs . remove ( & path) {
639
- Some ( doc) => version = Some ( doc. version ) ,
640
- None => log:: error!( "orphan DidCloseTextDocument: {}" , path) ,
637
+ if this. mem_docs . remove ( & path) . is_none ( ) {
638
+ log:: error!( "orphan DidCloseTextDocument: {}" , path) ;
641
639
}
642
640
643
641
this. semantic_tokens_cache . lock ( ) . remove ( & params. text_document . uri ) ;
@@ -646,17 +644,6 @@ impl GlobalState {
646
644
this. loader . handle . invalidate ( path. to_path_buf ( ) ) ;
647
645
}
648
646
}
649
-
650
- // Clear the diagnostics for the previously known version of the file.
651
- // This prevents stale "cargo check" diagnostics if the file is
652
- // closed, "cargo check" is run and then the file is reopened.
653
- this. send_notification :: < lsp_types:: notification:: PublishDiagnostics > (
654
- lsp_types:: PublishDiagnosticsParams {
655
- uri : params. text_document . uri ,
656
- diagnostics : Vec :: new ( ) ,
657
- version,
658
- } ,
659
- ) ;
660
647
Ok ( ( ) )
661
648
} ) ?
662
649
. on :: < lsp_types:: notification:: DidSaveTextDocument > ( |this, params| {
0 commit comments