@@ -16,6 +16,7 @@ use crate::{
1616 formatter:: server_formatter:: ServerFormatter ,
1717 linter:: {
1818 error_with_position:: DiagnosticReport ,
19+ options:: LintOptions ,
1920 server_linter:: { ServerLinter , ServerLinterRun } ,
2021 } ,
2122 options:: Options ,
@@ -155,10 +156,7 @@ impl WorkspaceWorker {
155156 /// Refresh the server linter with the current options
156157 /// This will recreate the linter and re-read the config files.
157158 /// Call this when the options have changed and the linter needs to be updated.
158- async fn refresh_server_linter ( & self ) {
159- let options = self . options . lock ( ) . await ;
160- let default_options = Options :: default ( ) ;
161- let lint_options = & options. as_ref ( ) . unwrap_or ( & default_options) . lint ;
159+ async fn refresh_server_linter ( & self , lint_options : & LintOptions ) {
162160 let server_linter = ServerLinter :: new ( & self . root_uri , lint_options) ;
163161
164162 * self . server_linter . write ( ) . await = Some ( server_linter) ;
@@ -303,7 +301,15 @@ impl WorkspaceWorker {
303301 let server_linter = server_linter_guard. as_ref ( ) ?;
304302 server_linter. get_cached_files_of_diagnostics ( )
305303 } ;
306- self . refresh_server_linter ( ) . await ;
304+ let lint_options = self
305+ . options
306+ . lock ( )
307+ . await
308+ . as_ref ( )
309+ . map ( |option| option. lint . clone ( ) )
310+ . unwrap_or_default ( ) ;
311+
312+ self . refresh_server_linter ( & lint_options) . await ;
307313 Some ( self . revalidate_diagnostics ( files) . await )
308314 }
309315
@@ -363,7 +369,7 @@ impl WorkspaceWorker {
363369 vec ! [ ]
364370 }
365371 } ;
366- self . refresh_server_linter ( ) . await ;
372+ self . refresh_server_linter ( & changed_options . lint ) . await ;
367373
368374 if current_option. lint . config_path != changed_options. lint . config_path {
369375 return (
0 commit comments