@@ -46,11 +46,6 @@ pub struct Runtime {
4646 resolver : Option < Resolver > ,
4747
4848 pub ( super ) file_system : Box < dyn RuntimeFileSystem + Sync + Send > ,
49-
50- // The language server uses more up to date source_text provided by `workspace/didChange` request.
51- // This is required to support `run: "onType"` configuration
52- #[ cfg( feature = "language_server" ) ]
53- source_text_cache : FxHashMap < Arc < OsStr > , String > ,
5449}
5550
5651/// Output of `Runtime::process_path`
@@ -179,8 +174,6 @@ impl Runtime {
179174 linter,
180175 resolver,
181176 file_system : Box :: new ( OsFileSystem ) ,
182- #[ cfg( feature = "language_server" ) ]
183- source_text_cache : FxHashMap :: default ( ) ,
184177 }
185178 }
186179
@@ -230,13 +223,6 @@ impl Runtime {
230223 }
231224 let source_type = source_type. unwrap_or_default ( ) ;
232225
233- // The language server uses more up to date source_text provided by `workspace/didChange` request.
234- // This is required to support `run: "onType"` configuration
235- #[ cfg( feature = "language_server" ) ]
236- if let Some ( source_text) = self . source_text_cache . get ( path. as_os_str ( ) ) {
237- return Some ( Ok ( ( source_type, source_text. clone ( ) ) ) ) ;
238- }
239-
240226 let file_result = self . file_system . read_to_string ( path) . map_err ( |e| {
241227 Error :: new ( OxcDiagnostic :: error ( format ! (
242228 "Failed to open file {path:?} with error \" {e}\" "
@@ -563,22 +549,14 @@ impl Runtime {
563549 pub ( super ) fn run_source < ' a > (
564550 & mut self ,
565551 allocator : & ' a oxc_allocator:: Allocator ,
566- path : & Arc < OsStr > ,
567- source_text : & str ,
568552 ) -> Vec < MessageWithPosition < ' a > > {
569553 use std:: sync:: Mutex ;
570554
571- // the language server can have more up to date source_text then the filesystem
572- #[ cfg( feature = "language_server" ) ]
573- {
574- self . source_text_cache . insert ( Arc :: clone ( path) , source_text. to_owned ( ) ) ;
575- }
576-
577555 let messages = Mutex :: new ( Vec :: < MessageWithPosition < ' a > > :: new ( ) ) ;
578556 let ( sender, _receiver) = mpsc:: channel ( ) ;
579557 rayon:: scope ( |scope| {
580558 self . resolve_modules ( scope, true , & sender, |me, mut module| {
581- module. content . with_dependent_mut ( |_owner , dependent| {
559+ module. content . with_dependent_mut ( |owner , dependent| {
582560 assert_eq ! ( module. section_module_records. len( ) , dependent. len( ) ) ;
583561
584562 for ( record_result, section) in
@@ -609,13 +587,13 @@ impl Runtime {
609587 let offset = labeled_span. offset ( ) as u32 ;
610588 let start_position = offset_to_position (
611589 offset + section. source . start ,
612- source_text,
590+ & owner . source_text ,
613591 ) ;
614592 let end_position = offset_to_position (
615593 offset
616594 + section. source . start
617595 + labeled_span. len ( ) as u32 ,
618- source_text,
596+ & owner . source_text ,
619597 ) ;
620598 let message = labeled_span
621599 . label ( )
@@ -642,11 +620,11 @@ impl Runtime {
642620 span : SpanPositionMessage :: new (
643621 offset_to_position (
644622 section. source . start + fix. span . start ,
645- source_text,
623+ & owner . source_text ,
646624 ) ,
647625 offset_to_position (
648626 section. source . start + fix. span . end ,
649- source_text,
627+ & owner . source_text ,
650628 ) ,
651629 )
652630 . with_message (
0 commit comments