File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
crates/rust-analyzer/src/handlers Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -511,12 +511,16 @@ pub(crate) fn handle_document_diagnostics(
511511 . into_iter ( )
512512 . filter_map ( |d| {
513513 let file = d. range . file_id ;
514- let diagnostic = convert_diagnostic ( & line_index, d) ;
515514 if file == file_id {
515+ let diagnostic = convert_diagnostic ( & line_index, d) ;
516516 return Some ( diagnostic) ;
517517 }
518518 if supports_related {
519- related_documents. entry ( file) . or_insert_with ( Vec :: new) . push ( diagnostic) ;
519+ let ( diagnostics, line_index) = related_documents
520+ . entry ( file)
521+ . or_insert_with ( || ( Vec :: new ( ) , snap. file_line_index ( file) . ok ( ) ) ) ;
522+ let diagnostic = convert_diagnostic ( line_index. as_mut ( ) ?, d) ;
523+ diagnostics. push ( diagnostic) ;
520524 }
521525 None
522526 } ) ;
@@ -529,7 +533,7 @@ pub(crate) fn handle_document_diagnostics(
529533 related_documents : related_documents. is_empty ( ) . not ( ) . then ( || {
530534 related_documents
531535 . into_iter ( )
532- . map ( |( id, items) | {
536+ . map ( |( id, ( items, _ ) ) | {
533537 (
534538 to_proto:: url ( & snap, id) ,
535539 lsp_types:: DocumentDiagnosticReportKind :: Full (
You can’t perform that action at this time.
0 commit comments