File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
crates/oxc_language_server/src Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ pub struct Options {
2323
2424impl Options {
2525 pub fn use_nested_configs ( & self ) -> bool {
26- !self . flags . contains_key ( "disable_nested_config" ) || self . config_path . is_some ( )
26+ !self . flags . contains_key ( "disable_nested_config" ) && self . config_path . is_none ( )
2727 }
2828
2929 pub fn fix_kind ( & self ) -> FixKind {
@@ -96,6 +96,7 @@ pub struct WorkspaceOption {
9696
9797#[ cfg( test) ]
9898mod test {
99+ use rustc_hash:: FxHashMap ;
99100 use serde_json:: json;
100101
101102 use super :: { Options , Run , WorkspaceOption } ;
@@ -178,4 +179,20 @@ mod test {
178179 assert_eq ! ( options. config_path, Some ( "./custom.json" . into( ) ) ) ;
179180 assert ! ( options. flags. is_empty( ) ) ;
180181 }
182+
183+ #[ test]
184+ fn test_use_nested_configs ( ) {
185+ let options = Options :: default ( ) ;
186+ assert ! ( options. use_nested_configs( ) ) ;
187+
188+ let options =
189+ Options { config_path : Some ( "config.json" . to_string ( ) ) , ..Default :: default ( ) } ;
190+ assert ! ( !options. use_nested_configs( ) ) ;
191+
192+ let mut flags = FxHashMap :: default ( ) ;
193+ flags. insert ( "disable_nested_config" . to_string ( ) , "true" . to_string ( ) ) ;
194+
195+ let options = Options { flags, ..Default :: default ( ) } ;
196+ assert ! ( !options. use_nested_configs( ) ) ;
197+ }
181198}
You can’t perform that action at this time.
0 commit comments