@@ -18,10 +18,10 @@ use tower_lsp_server::UriExt;
1818use crate :: linter:: {
1919 error_with_position:: DiagnosticReport ,
2020 isolated_lint_handler:: { IsolatedLintHandler , IsolatedLintHandlerOptions } ,
21+ options:: { LintOptions as LSPLintOptions , Run , UnusedDisableDirectives } ,
2122 tsgo_linter:: TsgoLinter ,
2223} ;
23- use crate :: options:: { Run , UnusedDisableDirectives } ;
24- use crate :: { ConcurrentHashMap , OXC_CONFIG_FILE , Options } ;
24+ use crate :: { ConcurrentHashMap , OXC_CONFIG_FILE } ;
2525
2626use super :: config_walker:: ConfigWalker ;
2727
@@ -80,7 +80,7 @@ impl ServerLinterDiagnostics {
8080}
8181
8282impl ServerLinter {
83- pub fn new ( root_uri : & Uri , options : & Options ) -> Self {
83+ pub fn new ( root_uri : & Uri , options : & LSPLintOptions ) -> Self {
8484 let root_path = root_uri. to_file_path ( ) . unwrap ( ) ;
8585 let mut nested_ignore_patterns = Vec :: new ( ) ;
8686 let ( nested_configs, mut extended_paths) =
@@ -186,7 +186,7 @@ impl ServerLinter {
186186 /// and insert them inside the nested configuration
187187 fn create_nested_configs (
188188 root_path : & Path ,
189- options : & Options ,
189+ options : & LSPLintOptions ,
190190 nested_ignore_patterns : & mut Vec < ( Vec < String > , PathBuf ) > ,
191191 ) -> ( ConcurrentHashMap < PathBuf , Config > , Vec < PathBuf > ) {
192192 let mut extended_paths = Vec :: new ( ) ;
@@ -394,9 +394,10 @@ mod test {
394394 use std:: path:: { Path , PathBuf } ;
395395
396396 use crate :: {
397- Options ,
398- linter:: server_linter:: { ServerLinter , normalize_path} ,
399- options:: Run ,
397+ linter:: {
398+ options:: { LintOptions , Run , UnusedDisableDirectives } ,
399+ server_linter:: { ServerLinter , normalize_path} ,
400+ } ,
400401 tester:: { Tester , get_file_path} ,
401402 } ;
402403 use rustc_hash:: FxHashMap ;
@@ -417,7 +418,7 @@ mod test {
417418 let mut nested_ignore_patterns = Vec :: new ( ) ;
418419 let ( configs, _) = ServerLinter :: create_nested_configs (
419420 Path :: new ( "/root/" ) ,
420- & Options { flags, ..Options :: default ( ) } ,
421+ & LintOptions { flags, ..LintOptions :: default ( ) } ,
421422 & mut nested_ignore_patterns,
422423 ) ;
423424
@@ -429,7 +430,7 @@ mod test {
429430 let mut nested_ignore_patterns = Vec :: new ( ) ;
430431 let ( configs, _) = ServerLinter :: create_nested_configs (
431432 & get_file_path ( "fixtures/linter/init_nested_configs" ) ,
432- & Options :: default ( ) ,
433+ & LintOptions :: default ( ) ,
433434 & mut nested_ignore_patterns,
434435 ) ;
435436 let configs = configs. pin ( ) ;
@@ -448,7 +449,7 @@ mod test {
448449 fn test_lint_on_run_on_type_on_type ( ) {
449450 Tester :: new (
450451 "fixtures/linter/lint_on_run/on_type" ,
451- Some ( Options { type_aware : true , run : Run :: OnType , ..Default :: default ( ) } ) ,
452+ Some ( LintOptions { type_aware : true , run : Run :: OnType , ..Default :: default ( ) } ) ,
452453 )
453454 . test_and_snapshot_single_file_with_run_type ( "on-type.ts" , Run :: OnType ) ;
454455 }
@@ -458,7 +459,7 @@ mod test {
458459 fn test_lint_on_run_on_type_on_save ( ) {
459460 Tester :: new (
460461 "fixtures/linter/lint_on_run/on_save" ,
461- Some ( Options { type_aware : true , run : Run :: OnType , ..Default :: default ( ) } ) ,
462+ Some ( LintOptions { type_aware : true , run : Run :: OnType , ..Default :: default ( ) } ) ,
462463 )
463464 . test_and_snapshot_single_file_with_run_type ( "on-save.ts" , Run :: OnSave ) ;
464465 }
@@ -468,7 +469,7 @@ mod test {
468469 fn test_lint_on_run_on_save_on_type ( ) {
469470 Tester :: new (
470471 "fixtures/linter/lint_on_run/on_save" ,
471- Some ( Options { type_aware : true , run : Run :: OnSave , ..Default :: default ( ) } ) ,
472+ Some ( LintOptions { type_aware : true , run : Run :: OnSave , ..Default :: default ( ) } ) ,
472473 )
473474 . test_and_snapshot_single_file_with_run_type ( "on-type.ts" , Run :: OnType ) ;
474475 }
@@ -478,7 +479,7 @@ mod test {
478479 fn test_lint_on_run_on_save_on_save ( ) {
479480 Tester :: new (
480481 "fixtures/linter/lint_on_run/on_type" ,
481- Some ( Options { type_aware : true , run : Run :: OnSave , ..Default :: default ( ) } ) ,
482+ Some ( LintOptions { type_aware : true , run : Run :: OnSave , ..Default :: default ( ) } ) ,
482483 )
483484 . test_and_snapshot_single_file_with_run_type ( "on-save.ts" , Run :: OnSave ) ;
484485 }
@@ -553,23 +554,22 @@ mod test {
553554 fn test_multiple_suggestions ( ) {
554555 Tester :: new (
555556 "fixtures/linter/multiple_suggestions" ,
556- Some ( Options {
557+ Some ( LintOptions {
557558 flags : FxHashMap :: from_iter ( [ (
558559 "fix_kind" . to_string ( ) ,
559560 "safe_fix_or_suggestion" . to_string ( ) ,
560561 ) ] ) ,
561- ..Options :: default ( )
562+ ..Default :: default ( )
562563 } ) ,
563564 )
564565 . test_and_snapshot_single_file ( "forward_ref.ts" ) ;
565566 }
566567
567568 #[ test]
568569 fn test_report_unused_directives ( ) {
569- use crate :: options:: UnusedDisableDirectives ;
570570 Tester :: new (
571571 "fixtures/linter/unused_disabled_directives" ,
572- Some ( Options {
572+ Some ( LintOptions {
573573 unused_disable_directives : UnusedDisableDirectives :: Deny ,
574574 ..Default :: default ( )
575575 } ) ,
@@ -588,7 +588,7 @@ mod test {
588588 fn test_ts_alias ( ) {
589589 Tester :: new (
590590 "fixtures/linter/ts_path_alias" ,
591- Some ( Options {
591+ Some ( LintOptions {
592592 ts_config_path : Some ( "./deep/tsconfig.json" . to_string ( ) ) ,
593593 ..Default :: default ( )
594594 } ) ,
@@ -601,7 +601,7 @@ mod test {
601601 fn test_tsgo_lint ( ) {
602602 let tester = Tester :: new (
603603 "fixtures/linter/tsgolint" ,
604- Some ( Options { type_aware : true , run : Run :: OnSave , ..Default :: default ( ) } ) ,
604+ Some ( LintOptions { type_aware : true , run : Run :: OnSave , ..Default :: default ( ) } ) ,
605605 ) ;
606606 tester. test_and_snapshot_single_file ( "no-floating-promises/index.ts" ) ;
607607 }
0 commit comments