File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
crates/rust-analyzer/src/config Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -522,5 +522,31 @@ mod tests {
522
522
crate :: config:: DiscriminantHintsDef :: Always
523
523
) ;
524
524
assert_eq ! ( local. completion_autoself_enable, false ) ;
525
+
526
+ // ----
527
+
528
+ // Now move crate b to the root. This gives a new FileId for crate_b/ra.toml.
529
+ let source_roots = [ "/root/crate_a" , "/root/crate_b" ] . map ( Path :: new) . map ( AbsPath :: assert) ;
530
+ let [ crate_a, crate_b] = source_roots
531
+ . map ( |dir| dir. join ( "rust-analyzer.toml" ) )
532
+ . map ( |path| vfs. alloc_file_id ( path. into ( ) ) ) ;
533
+ let new_source_roots = source_roots. into_iter ( ) . map ( |abs| abs. to_path_buf ( ) ) . collect ( ) ;
534
+ let changes = ConfigChanges {
535
+ client_change : None ,
536
+ set_project_root : None , // already set in ConfigDb::new(...)
537
+ set_source_roots : Some ( new_source_roots) ,
538
+ ra_toml_changes : dbg ! ( vfs. take_changes( ) ) ,
539
+ } ;
540
+
541
+ dbg ! ( config_tree. apply_changes( changes, & mut vfs) ) ;
542
+ let local = config_tree. local_config ( crate_b) ;
543
+
544
+ // Still inherits from xdg
545
+ assert_eq ! (
546
+ local. inlayHints_discriminantHints_enable,
547
+ crate :: config:: DiscriminantHintsDef :: Always
548
+ ) ;
549
+ // new crate_b does not inherit from crate_a
550
+ assert_eq ! ( local. completion_autoself_enable, true ) ;
525
551
}
526
552
}
You can’t perform that action at this time.
0 commit comments