@@ -19,7 +19,6 @@ use crate::linter::{
1919 error_with_position:: DiagnosticReport ,
2020 isolated_lint_handler:: { IsolatedLintHandler , IsolatedLintHandlerOptions } ,
2121 options:: { LintOptions as LSPLintOptions , Run } ,
22- tsgo_linter:: TsgoLinter ,
2322} ;
2423use crate :: { ConcurrentHashMap , OXC_CONFIG_FILE } ;
2524
@@ -34,7 +33,6 @@ pub enum ServerLinterRun {
3433
3534pub struct ServerLinter {
3635 isolated_linter : Arc < Mutex < IsolatedLintHandler > > ,
37- tsgo_linter : Arc < Option < TsgoLinter > > ,
3836 ignore_matcher : LintIgnoreMatcher ,
3937 gitignore_glob : Vec < Gitignore > ,
4038 lint_on_run : Run ,
@@ -45,7 +43,6 @@ pub struct ServerLinter {
4543#[ derive( Debug , Default ) ]
4644struct ServerLinterDiagnostics {
4745 isolated_linter : Arc < ConcurrentHashMap < String , Option < Vec < DiagnosticReport > > > > ,
48- tsgo_linter : Arc < ConcurrentHashMap < String , Option < Vec < DiagnosticReport > > > > ,
4946}
5047
5148impl ServerLinterDiagnostics {
@@ -58,29 +55,15 @@ impl ServerLinterDiagnostics {
5855 reports. extend ( diagnostics. clone ( ) ) ;
5956 }
6057 }
61- if let Some ( entry) = self . tsgo_linter . pin ( ) . get ( path) {
62- found = true ;
63- if let Some ( diagnostics) = entry {
64- reports. extend ( diagnostics. clone ( ) ) ;
65- }
66- }
6758 if found { Some ( reports) } else { None }
6859 }
6960
7061 pub fn remove_diagnostics ( & self , path : & str ) {
7162 self . isolated_linter . pin ( ) . remove ( path) ;
72- self . tsgo_linter . pin ( ) . remove ( path) ;
7363 }
7464
7565 pub fn get_cached_files_of_diagnostics ( & self ) -> Vec < String > {
76- let isolated_files = self . isolated_linter . pin ( ) . keys ( ) . cloned ( ) . collect :: < Vec < _ > > ( ) ;
77- let tsgo_files = self . tsgo_linter . pin ( ) . keys ( ) . cloned ( ) . collect :: < Vec < _ > > ( ) ;
78-
79- let mut files = Vec :: with_capacity ( isolated_files. len ( ) + tsgo_files. len ( ) ) ;
80- files. extend ( isolated_files) ;
81- files. extend ( tsgo_files) ;
82- files. dedup ( ) ;
83- files
66+ self . isolated_linter . pin ( ) . keys ( ) . cloned ( ) . collect :: < Vec < _ > > ( )
8467 }
8568}
8669
@@ -152,9 +135,10 @@ impl ServerLinter {
152135
153136 let isolated_linter = IsolatedLintHandler :: new (
154137 lint_options,
155- config_store. clone ( ) , // clone because tsgo linter needs it
138+ config_store,
156139 & IsolatedLintHandlerOptions {
157140 use_cross_module,
141+ type_aware : options. type_aware ,
158142 root_path : root_path. to_path_buf ( ) ,
159143 tsconfig_path : options. ts_config_path . as_ref ( ) . map ( |path| {
160144 let path = Path :: new ( path) . to_path_buf ( ) ;
@@ -174,11 +158,6 @@ impl ServerLinter {
174158 extended_paths,
175159 lint_on_run : options. run ,
176160 diagnostics : ServerLinterDiagnostics :: default ( ) ,
177- tsgo_linter : if options. type_aware {
178- Arc :: new ( Some ( TsgoLinter :: new ( & root_path, config_store) ) )
179- } else {
180- Arc :: new ( None )
181- } ,
182161 }
183162 }
184163
@@ -333,10 +312,7 @@ impl ServerLinter {
333312 ( ServerLinterRun :: OnType , Run :: OnSave ) => ( false , false ) ,
334313 // In onType mode, only TypeScript type checking runs on save
335314 // If type_aware is disabled (tsgo_linter is None), skip everything to preserve diagnostics
336- ( ServerLinterRun :: OnSave , Run :: OnType ) => {
337- let should_run_tsgo = self . tsgo_linter . as_ref ( ) . is_some ( ) ;
338- ( false , should_run_tsgo)
339- }
315+ ( ServerLinterRun :: OnSave , Run :: OnType ) => ( false , true ) ,
340316 } ;
341317
342318 // return `None` when both tools do not want to be used
@@ -356,13 +332,6 @@ impl ServerLinter {
356332 self . diagnostics . isolated_linter . pin ( ) . insert ( uri. to_string ( ) , diagnostics) ;
357333 }
358334
359- if tsgolint && let Some ( tsgo_linter) = self . tsgo_linter . as_ref ( ) {
360- self . diagnostics
361- . tsgo_linter
362- . pin ( )
363- . insert ( uri. to_string ( ) , tsgo_linter. lint_file ( uri, content. clone ( ) ) ) ;
364- }
365-
366335 self . diagnostics . get_diagnostics ( & uri. to_string ( ) )
367336 }
368337
@@ -463,31 +432,23 @@ mod test {
463432 fn test_get_diagnostics_found_and_none_entries ( ) {
464433 let key = "file:///test.js" . to_string ( ) ;
465434
466- // Case 1: Both entries present, Some diagnostics
435+ // Case 1: Entry present, Some diagnostics
467436 let diag = DiagnosticReport :: default ( ) ;
468437 let diag_map = ConcurrentHashMap :: default ( ) ;
469438 diag_map. pin ( ) . insert ( key. clone ( ) , Some ( vec ! [ diag. clone( ) ] ) ) ;
470- let tsgo_map = ConcurrentHashMap :: default ( ) ;
471- tsgo_map. pin ( ) . insert ( key. clone ( ) , Some ( vec ! [ diag] ) ) ;
472439
473- let server_diag = super :: ServerLinterDiagnostics {
474- isolated_linter : std:: sync:: Arc :: new ( diag_map) ,
475- tsgo_linter : std:: sync:: Arc :: new ( tsgo_map) ,
476- } ;
440+ let server_diag =
441+ super :: ServerLinterDiagnostics { isolated_linter : std:: sync:: Arc :: new ( diag_map) } ;
477442 let result = server_diag. get_diagnostics ( & key) ;
478443 assert ! ( result. is_some( ) ) ;
479444 assert_eq ! ( result. unwrap( ) . len( ) , 2 ) ;
480445
481446 // Case 2: Entry present, but value is None
482447 let diag_map_none = ConcurrentHashMap :: default ( ) ;
483448 diag_map_none. pin ( ) . insert ( key. clone ( ) , None ) ;
484- let tsgo_map_none = ConcurrentHashMap :: default ( ) ;
485- tsgo_map_none. pin ( ) . insert ( key. clone ( ) , None ) ;
486449
487- let server_diag_none = ServerLinterDiagnostics {
488- isolated_linter : std:: sync:: Arc :: new ( diag_map_none) ,
489- tsgo_linter : std:: sync:: Arc :: new ( tsgo_map_none) ,
490- } ;
450+ let server_diag_none =
451+ ServerLinterDiagnostics { isolated_linter : std:: sync:: Arc :: new ( diag_map_none) } ;
491452 let result_none = server_diag_none. get_diagnostics ( & key) ;
492453 assert ! ( result_none. is_some( ) ) ;
493454 assert_eq ! ( result_none. unwrap( ) . len( ) , 0 ) ;
0 commit comments