@@ -38,10 +38,6 @@ pub enum ConfigTreeError {
38
38
pub struct ConfigChanges {
39
39
ra_toml_changes : Vec < vfs:: ChangedFile > ,
40
40
/// - `None` => no change
41
- /// - `Some(None)` => the XDG_CONFIG_HOME rust-analyzer.toml file was deleted
42
- /// - `Some(Some(...))` => the XDG_CONFIG_HOME rust-analyzer.toml file was updated
43
- xdg_config_change : Option < Option < Arc < ConfigInput > > > ,
44
- /// - `None` => no change
45
41
/// - `Some(None)` => the client config was removed / reset or something
46
42
/// - `Some(Some(...))` => the client config was updated
47
43
client_change : Option < Option < Arc < ConfigInput > > > ,
@@ -318,22 +314,12 @@ impl ConfigTree {
318
314
errors : & mut Vec < ConfigTreeError > ,
319
315
) {
320
316
let mut scratch_errors = Vec :: new ( ) ;
321
- let ConfigChanges { client_change, ra_toml_changes, xdg_config_change, parent_changes } =
322
- changes;
317
+ let ConfigChanges { client_change, ra_toml_changes, parent_changes } = changes;
323
318
324
319
if let Some ( change) = client_change {
325
320
self . client_config = change;
326
321
}
327
322
328
- if let Some ( change) = xdg_config_change {
329
- let node = self
330
- . tree
331
- . get_mut ( self . xdg_config_node_id )
332
- . expect ( "client_config node should exist" ) ;
333
- node. get_mut ( ) . input = change;
334
- self . invalidate_subtree ( self . xdg_config_node_id ) ;
335
- }
336
-
337
323
for ConfigParentChange { file_id, parent } in parent_changes {
338
324
let node_id = self . ensure_node ( file_id) ;
339
325
let parent_node_id = match parent {
@@ -455,5 +441,34 @@ mod tests {
455
441
assert_eq ! ( local. completion_autoimport_enable, false ) ;
456
442
// from client
457
443
assert_eq ! ( local. semanticHighlighting_strings_enable, false ) ;
444
+
445
+ vfs. set_file_id_contents (
446
+ xdg_config_file_id,
447
+ Some (
448
+ r#"
449
+ # default is "never"
450
+ [inlayHints.discriminantHints]
451
+ enable = "always"
452
+ "#
453
+ . to_string ( )
454
+ . into_bytes ( ) ,
455
+ ) ,
456
+ ) ;
457
+
458
+ let changes = ConfigChanges {
459
+ ra_toml_changes : vfs. take_changes ( ) ,
460
+ parent_changes : vec ! [ ] ,
461
+ client_change : None ,
462
+ } ;
463
+ dbg ! ( config_tree. apply_changes( changes, & vfs) ) ;
464
+
465
+ let local2 = config_tree. read_config ( crate_a) . unwrap ( ) ;
466
+ // should have recomputed
467
+ assert ! ( !Arc :: ptr_eq( & local, & local2) ) ;
468
+
469
+ assert_eq ! (
470
+ local. inlayHints_discriminantHints_enable,
471
+ crate :: config:: DiscriminantHintsDef :: Always
472
+ ) ;
458
473
}
459
474
}
0 commit comments