@@ -359,7 +359,8 @@ impl DiagnosticMessage {
359359 . or_else ( || self . details . iter ( ) . find_map ( |d| d. location . as_ref ( ) ) ) ;
360360
361361 if let Some ( loc) = location {
362- if let Some ( ariadne_output) = self . render_ariadne_source_context ( loc, ctx. unwrap ( ) , options. enable_hyperlinks )
362+ if let Some ( ariadne_output) =
363+ self . render_ariadne_source_context ( loc, ctx. unwrap ( ) , options. enable_hyperlinks )
363364 {
364365 result. push_str ( & ariadne_output) ;
365366 true
@@ -581,6 +582,7 @@ impl DiagnosticMessage {
581582 /// and other terminal emulators for opening files at specific positions.
582583 ///
583584 /// Returns the wrapped path if conditions are met, otherwise returns the original path.
585+ #[ cfg( not( target_family = "wasm" ) ) ]
584586 fn wrap_path_with_hyperlink (
585587 path : & str ,
586588 has_disk_file : bool ,
@@ -624,6 +626,19 @@ impl DiagnosticMessage {
624626 format ! ( "\x1b ]8;;{}\x1b \\ {}\x1b ]8;;\x1b \\ " , file_url, path)
625627 }
626628
629+ /// WASM version: hyperlinks don't make sense in WASM environments (no file system).
630+ /// Just return the path unmodified.
631+ #[ cfg( target_family = "wasm" ) ]
632+ fn wrap_path_with_hyperlink (
633+ path : & str ,
634+ _has_disk_file : bool ,
635+ _line : Option < usize > ,
636+ _column : Option < usize > ,
637+ _enable_hyperlinks : bool ,
638+ ) -> String {
639+ path. to_string ( )
640+ }
641+
627642 /// Render source context using ariadne (private helper for to_text).
628643 ///
629644 /// This produces the visual source code snippet with highlighting.
@@ -662,7 +677,13 @@ impl DiagnosticMessage {
662677 // Line and column numbers are 1-indexed for display (start_mapped.location uses 0-indexed)
663678 let line = Some ( start_mapped. location . row + 1 ) ;
664679 let column = Some ( start_mapped. location . column + 1 ) ;
665- let display_path = Self :: wrap_path_with_hyperlink ( & file. path , is_disk_file, line, column, enable_hyperlinks) ;
680+ let display_path = Self :: wrap_path_with_hyperlink (
681+ & file. path ,
682+ is_disk_file,
683+ line,
684+ column,
685+ enable_hyperlinks,
686+ ) ;
666687
667688 // Determine report kind and color
668689 let ( report_kind, main_color) = match self . kind {
0 commit comments