@@ -21,11 +21,13 @@ use super::config_walker::ConfigWalker;
2121pub struct ServerLinter {
2222 isolated_linter : Arc < IsolatedLintHandler > ,
2323 gitignore_glob : Vec < Gitignore > ,
24+ #[ expect( dead_code) ]
25+ extended_paths : Vec < PathBuf > ,
2426}
2527
2628impl ServerLinter {
2729 pub fn new ( root_uri : & Uri , options : & Options ) -> Self {
28- let nested_configs = Self :: create_nested_configs ( root_uri, options) ;
30+ let ( nested_configs, mut extended_paths ) = Self :: create_nested_configs ( root_uri, options) ;
2931 let root_path = root_uri. to_file_path ( ) . unwrap ( ) ;
3032 let relative_config_path = options. config_path . clone ( ) ;
3133 let oxlintrc = if let Some ( relative_config_path) = relative_config_path {
@@ -61,6 +63,7 @@ impl ServerLinter {
6163 config_builder. plugins ( ) . has_import ( )
6264 } ;
6365
66+ extended_paths. extend ( config_builder. extended_paths . clone ( ) ) ;
6467 let base_config = config_builder. build ( ) ;
6568
6669 let lint_options = LintOptions { fix : options. fix_kind ( ) , ..Default :: default ( ) } ;
@@ -88,6 +91,7 @@ impl ServerLinter {
8891 Self {
8992 isolated_linter : Arc :: new ( isolated_linter) ,
9093 gitignore_glob : Self :: create_ignore_glob ( root_uri, & oxlintrc) ,
94+ extended_paths,
9195 }
9296 }
9397
@@ -96,10 +100,11 @@ impl ServerLinter {
96100 fn create_nested_configs (
97101 root_uri : & Uri ,
98102 options : & Options ,
99- ) -> ConcurrentHashMap < PathBuf , Config > {
103+ ) -> ( ConcurrentHashMap < PathBuf , Config > , Vec < PathBuf > ) {
104+ let mut extended_paths = Vec :: new ( ) ;
100105 // nested config is disabled, no need to search for configs
101106 if !options. use_nested_configs ( ) {
102- return ConcurrentHashMap :: default ( ) ;
107+ return ( ConcurrentHashMap :: default ( ) , extended_paths ) ;
103108 }
104109
105110 let root_path = root_uri. to_file_path ( ) . expect ( "Failed to convert URI to file path" ) ;
@@ -123,12 +128,11 @@ impl ServerLinter {
123128 warn ! ( "Skipping config (builder failed): {}" , file_path. display( ) ) ;
124129 continue ;
125130 } ;
126- let config_store = config_store_builder. build ( ) ;
127-
128- nested_configs. pin ( ) . insert ( dir_path. to_path_buf ( ) , config_store) ;
131+ extended_paths. extend ( config_store_builder. extended_paths . clone ( ) ) ;
132+ nested_configs. pin ( ) . insert ( dir_path. to_path_buf ( ) , config_store_builder. build ( ) ) ;
129133 }
130134
131- nested_configs
135+ ( nested_configs, extended_paths )
132136 }
133137
134138 fn create_ignore_glob ( root_uri : & Uri , oxlintrc : & Oxlintrc ) -> Vec < Gitignore > {
@@ -257,7 +261,7 @@ mod test {
257261 let mut flags = FxHashMap :: default ( ) ;
258262 flags. insert ( "disable_nested_configs" . to_string ( ) , "true" . to_string ( ) ) ;
259263
260- let configs = ServerLinter :: create_nested_configs (
264+ let ( configs, _ ) = ServerLinter :: create_nested_configs (
261265 & Uri :: from_str ( "file:///root/" ) . unwrap ( ) ,
262266 & Options { flags, ..Options :: default ( ) } ,
263267 ) ;
@@ -267,7 +271,7 @@ mod test {
267271
268272 #[ test]
269273 fn test_create_nested_configs ( ) {
270- let configs = ServerLinter :: create_nested_configs (
274+ let ( configs, _ ) = ServerLinter :: create_nested_configs (
271275 & get_file_uri ( "fixtures/linter/init_nested_configs" ) ,
272276 & Options :: default ( ) ,
273277 ) ;
0 commit comments