File tree 3 files changed +18
-8
lines changed
3 files changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -462,11 +462,6 @@ pub(crate) fn map_rust_diagnostic_to_lsp(
462
462
message : "original diagnostic" . to_string ( ) ,
463
463
} ;
464
464
for sub in & subdiagnostics {
465
- let mut message = sub. related . message . clone ( ) ;
466
- // Change empty message to " ", as they greatly confuse VS Code.
467
- if message. is_empty ( ) {
468
- message = String :: from ( " " ) ;
469
- }
470
465
diagnostics. push ( MappedRustDiagnostic {
471
466
url : sub. related . location . uri . clone ( ) ,
472
467
fix : sub. suggested_fix . clone ( ) ,
@@ -476,7 +471,7 @@ pub(crate) fn map_rust_diagnostic_to_lsp(
476
471
code : code. clone ( ) . map ( lsp_types:: NumberOrString :: String ) ,
477
472
code_description : code_description. clone ( ) ,
478
473
source : Some ( source. clone ( ) ) ,
479
- message,
474
+ message : sub . related . message . clone ( ) ,
480
475
related_information : Some ( vec ! [ back_ref. clone( ) ] ) ,
481
476
tags : None , // don't apply modifiers again
482
477
data : None ,
Original file line number Diff line number Diff line change @@ -1318,7 +1318,8 @@ pub(crate) fn publish_diagnostics(
1318
1318
. unwrap ( ) ,
1319
1319
} ) ,
1320
1320
source : Some ( "rust-analyzer" . to_string ( ) ) ,
1321
- message : d. message ,
1321
+ // https://github.com/rust-lang/rust-analyzer/issues/11404
1322
+ message : if !d. message . is_empty ( ) { d. message } else { " " . to_string ( ) } ,
1322
1323
related_information : None ,
1323
1324
tags : if d. unused { Some ( vec ! [ DiagnosticTag :: UNNECESSARY ] ) } else { None } ,
1324
1325
data : None ,
Original file line number Diff line number Diff line change @@ -487,7 +487,21 @@ impl GlobalState {
487
487
}
488
488
489
489
let url = file_id_to_url ( & self . vfs . read ( ) . 0 , file_id) ;
490
- let diagnostics = self . diagnostics . diagnostics_for ( file_id) . cloned ( ) . collect ( ) ;
490
+ let mut diagnostics =
491
+ self . diagnostics . diagnostics_for ( file_id) . cloned ( ) . collect :: < Vec < _ > > ( ) ;
492
+ // https://github.com/rust-lang/rust-analyzer/issues/11404
493
+ for d in & mut diagnostics {
494
+ if d. message . is_empty ( ) {
495
+ d. message = " " . to_string ( ) ;
496
+ }
497
+ if let Some ( rds) = d. related_information . as_mut ( ) {
498
+ for rd in rds {
499
+ if rd. message . is_empty ( ) {
500
+ rd. message = " " . to_string ( ) ;
501
+ }
502
+ }
503
+ }
504
+ }
491
505
let version = from_proto:: vfs_path ( & url)
492
506
. map ( |path| self . mem_docs . get ( & path) . map ( |it| it. version ) )
493
507
. unwrap_or_default ( ) ;
You can’t perform that action at this time.
0 commit comments