@@ -633,11 +633,9 @@ impl GlobalState {
633633 Ok ( ( ) )
634634 } ) ?
635635 . on :: < lsp_types:: notification:: DidCloseTextDocument > ( |this, params| {
636- let mut version = None ;
637636 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) ;
641639 }
642640
643641 this. semantic_tokens_cache . lock ( ) . remove ( & params. text_document . uri ) ;
@@ -646,17 +644,6 @@ impl GlobalState {
646644 this. loader . handle . invalidate ( path. to_path_buf ( ) ) ;
647645 }
648646 }
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- ) ;
660647 Ok ( ( ) )
661648 } ) ?
662649 . on :: < lsp_types:: notification:: DidSaveTextDocument > ( |this, params| {
0 commit comments