@@ -554,6 +554,7 @@ impl<'l> Runtime<'l> {
554554 allocator : & ' a oxc_allocator:: Allocator ,
555555 ) -> Vec < MessageWithPosition < ' a > > {
556556 use oxc_allocator:: CloneIn ;
557+ use oxc_data_structures:: rope:: Rope ;
557558 use std:: sync:: Mutex ;
558559
559560 use crate :: {
@@ -564,11 +565,12 @@ impl<'l> Runtime<'l> {
564565
565566 fn fix_to_fix_with_position < ' a > (
566567 fix : & Fix < ' a > ,
568+ rope : & Rope ,
567569 offset : u32 ,
568570 source_text : & str ,
569571 ) -> FixWithPosition < ' a > {
570- let start_position = offset_to_position ( offset + fix. span . start , source_text) ;
571- let end_position = offset_to_position ( offset + fix. span . end , source_text) ;
572+ let start_position = offset_to_position ( rope , offset + fix. span . start , source_text) ;
573+ let end_position = offset_to_position ( rope , offset + fix. span . end , source_text) ;
572574 FixWithPosition {
573575 content : fix. content . clone ( ) ,
574576 span : SpanPositionMessage :: new ( start_position, end_position)
@@ -583,6 +585,8 @@ impl<'l> Runtime<'l> {
583585 module. content . with_dependent_mut ( |owner, dependent| {
584586 assert_eq ! ( module. section_module_records. len( ) , dependent. len( ) ) ;
585587
588+ let rope = & Rope :: from_str ( & owner. source_text ) ;
589+
586590 for ( record_result, section) in
587591 module. section_module_records . into_iter ( ) . zip ( dependent. drain ( ..) )
588592 {
@@ -610,10 +614,12 @@ impl<'l> Runtime<'l> {
610614 . map ( |labeled_span| {
611615 let offset = labeled_span. offset ( ) as u32 ;
612616 let start_position = offset_to_position (
617+ rope,
613618 offset + section. source . start ,
614619 & owner. source_text ,
615620 ) ;
616621 let end_position = offset_to_position (
622+ rope,
617623 offset
618624 + section. source . start
619625 + labeled_span. len ( ) as u32 ,
@@ -647,6 +653,7 @@ impl<'l> Runtime<'l> {
647653 PossibleFixesWithPosition :: Single (
648654 fix_to_fix_with_position (
649655 fix,
656+ rope,
650657 section. source . start ,
651658 & owner. source_text ,
652659 ) ,
@@ -659,6 +666,7 @@ impl<'l> Runtime<'l> {
659666 . map ( |fix| {
660667 fix_to_fix_with_position (
661668 fix,
669+ rope,
662670 section. source . start ,
663671 & owner. source_text ,
664672 )
0 commit comments