@@ -11,25 +11,28 @@ use super::isolated_lint_handler::IsolatedLintHandlerOptions;
1111
1212#[ derive( Clone ) ]
1313pub struct ServerLinter {
14- linter : Arc < Linter > ,
15- options : Arc < IsolatedLintHandlerOptions > ,
14+ isolated_linter : Arc < IsolatedLintHandler > ,
1615}
1716
1817impl ServerLinter {
1918 pub fn new ( options : IsolatedLintHandlerOptions ) -> Self {
2019 let config_store =
2120 ConfigStoreBuilder :: default ( ) . build ( ) . expect ( "Failed to build config store" ) ;
2221 let linter = Linter :: new ( LintOptions :: default ( ) , config_store) . with_fix ( FixKind :: SafeFix ) ;
23- Self { linter : Arc :: new ( linter) , options : Arc :: new ( options) }
22+
23+ let isolated_linter = Arc :: new ( IsolatedLintHandler :: new ( linter, options) ) ;
24+
25+ Self { isolated_linter }
2426 }
2527
2628 pub fn new_with_linter ( linter : Linter , options : IsolatedLintHandlerOptions ) -> Self {
27- Self { linter : Arc :: new ( linter) , options : Arc :: new ( options) }
29+ let isolated_linter = Arc :: new ( IsolatedLintHandler :: new ( linter, options) ) ;
30+
31+ Self { isolated_linter }
2832 }
2933
3034 pub fn run_single ( & self , uri : & Uri , content : Option < String > ) -> Option < Vec < DiagnosticReport > > {
31- IsolatedLintHandler :: new ( Arc :: clone ( & self . linter ) , Arc :: clone ( & self . options ) )
32- . run_single ( & uri. to_file_path ( ) . unwrap ( ) , content)
35+ self . isolated_linter . run_single ( & uri. to_file_path ( ) . unwrap ( ) , content)
3336 }
3437}
3538
0 commit comments