@@ -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 ( ) ;
@@ -397,9 +397,10 @@ mod test {
397397 use std:: path:: { Path , PathBuf } ;
398398
399399 use crate :: {
400- Options ,
401- linter:: server_linter:: { ServerLinter , normalize_path} ,
402- options:: Run ,
400+ linter:: {
401+ options:: { LintOptions , Run , UnusedDisableDirectives } ,
402+ server_linter:: { ServerLinter , normalize_path} ,
403+ } ,
403404 tester:: { Tester , get_file_path} ,
404405 } ;
405406 use rustc_hash:: FxHashMap ;
@@ -420,7 +421,7 @@ mod test {
420421 let mut nested_ignore_patterns = Vec :: new ( ) ;
421422 let ( configs, _) = ServerLinter :: create_nested_configs (
422423 Path :: new ( "/root/" ) ,
423- & Options { flags, ..Options :: default ( ) } ,
424+ & LintOptions { flags, ..LintOptions :: default ( ) } ,
424425 & mut nested_ignore_patterns,
425426 ) ;
426427
@@ -432,7 +433,7 @@ mod test {
432433 let mut nested_ignore_patterns = Vec :: new ( ) ;
433434 let ( configs, _) = ServerLinter :: create_nested_configs (
434435 & get_file_path ( "fixtures/linter/init_nested_configs" ) ,
435- & Options :: default ( ) ,
436+ & LintOptions :: default ( ) ,
436437 & mut nested_ignore_patterns,
437438 ) ;
438439 let configs = configs. pin ( ) ;
@@ -451,7 +452,7 @@ mod test {
451452 fn test_lint_on_run_on_type_on_type ( ) {
452453 Tester :: new (
453454 "fixtures/linter/lint_on_run/on_type" ,
454- Some ( Options { type_aware : true , run : Run :: OnType , ..Default :: default ( ) } ) ,
455+ Some ( LintOptions { type_aware : true , run : Run :: OnType , ..Default :: default ( ) } ) ,
455456 )
456457 . test_and_snapshot_single_file_with_run_type ( "on-type.ts" , Run :: OnType ) ;
457458 }
@@ -461,7 +462,7 @@ mod test {
461462 fn test_lint_on_run_on_type_on_save ( ) {
462463 Tester :: new (
463464 "fixtures/linter/lint_on_run/on_save" ,
464- Some ( Options { type_aware : true , run : Run :: OnType , ..Default :: default ( ) } ) ,
465+ Some ( LintOptions { type_aware : true , run : Run :: OnType , ..Default :: default ( ) } ) ,
465466 )
466467 . test_and_snapshot_single_file_with_run_type ( "on-save.ts" , Run :: OnSave ) ;
467468 }
@@ -471,7 +472,7 @@ mod test {
471472 fn test_lint_on_run_on_save_on_type ( ) {
472473 Tester :: new (
473474 "fixtures/linter/lint_on_run/on_save" ,
474- Some ( Options { type_aware : true , run : Run :: OnSave , ..Default :: default ( ) } ) ,
475+ Some ( LintOptions { type_aware : true , run : Run :: OnSave , ..Default :: default ( ) } ) ,
475476 )
476477 . test_and_snapshot_single_file_with_run_type ( "on-type.ts" , Run :: OnType ) ;
477478 }
@@ -481,7 +482,7 @@ mod test {
481482 fn test_lint_on_run_on_save_on_save ( ) {
482483 Tester :: new (
483484 "fixtures/linter/lint_on_run/on_type" ,
484- Some ( Options { type_aware : true , run : Run :: OnSave , ..Default :: default ( ) } ) ,
485+ Some ( LintOptions { type_aware : true , run : Run :: OnSave , ..Default :: default ( ) } ) ,
485486 )
486487 . test_and_snapshot_single_file_with_run_type ( "on-save.ts" , Run :: OnSave ) ;
487488 }
@@ -491,7 +492,7 @@ mod test {
491492 fn test_lint_on_run_on_type_on_save_without_type_aware ( ) {
492493 Tester :: new (
493494 "fixtures/linter/lint_on_run/on_type" ,
494- Some ( Options { type_aware : false , run : Run :: OnType , ..Default :: default ( ) } ) ,
495+ Some ( LintOptions { type_aware : false , run : Run :: OnType , ..Default :: default ( ) } ) ,
495496 )
496497 . test_and_snapshot_single_file_with_run_type ( "on-save-no-type-aware.ts" , Run :: OnSave ) ;
497498 }
@@ -566,23 +567,22 @@ mod test {
566567 fn test_multiple_suggestions ( ) {
567568 Tester :: new (
568569 "fixtures/linter/multiple_suggestions" ,
569- Some ( Options {
570+ Some ( LintOptions {
570571 flags : FxHashMap :: from_iter ( [ (
571572 "fix_kind" . to_string ( ) ,
572573 "safe_fix_or_suggestion" . to_string ( ) ,
573574 ) ] ) ,
574- ..Options :: default ( )
575+ ..Default :: default ( )
575576 } ) ,
576577 )
577578 . test_and_snapshot_single_file ( "forward_ref.ts" ) ;
578579 }
579580
580581 #[ test]
581582 fn test_report_unused_directives ( ) {
582- use crate :: options:: UnusedDisableDirectives ;
583583 Tester :: new (
584584 "fixtures/linter/unused_disabled_directives" ,
585- Some ( Options {
585+ Some ( LintOptions {
586586 unused_disable_directives : UnusedDisableDirectives :: Deny ,
587587 ..Default :: default ( )
588588 } ) ,
@@ -601,7 +601,7 @@ mod test {
601601 fn test_ts_alias ( ) {
602602 Tester :: new (
603603 "fixtures/linter/ts_path_alias" ,
604- Some ( Options {
604+ Some ( LintOptions {
605605 ts_config_path : Some ( "./deep/tsconfig.json" . to_string ( ) ) ,
606606 ..Default :: default ( )
607607 } ) ,
@@ -614,7 +614,7 @@ mod test {
614614 fn test_tsgo_lint ( ) {
615615 let tester = Tester :: new (
616616 "fixtures/linter/tsgolint" ,
617- Some ( Options { type_aware : true , run : Run :: OnSave , ..Default :: default ( ) } ) ,
617+ Some ( LintOptions { type_aware : true , run : Run :: OnSave , ..Default :: default ( ) } ) ,
618618 ) ;
619619 tester. test_and_snapshot_single_file ( "no-floating-promises/index.ts" ) ;
620620 }
0 commit comments