@@ -60,7 +60,7 @@ mod patch_old_style;
60
60
// To deprecate an option by replacing it with another name use `new_name | `old_name` so that we keep
61
61
// parsing the old name.
62
62
config_data ! {
63
- global: struct GlobalConfigData {
63
+ global: struct GlobalConfigData <- GlobalConfigInput {
64
64
/// Whether to insert #[must_use] when generating `as_` methods
65
65
/// for enum variants.
66
66
assist_emitMustUse: bool = false ,
@@ -366,7 +366,7 @@ config_data! {
366
366
}
367
367
368
368
config_data ! {
369
- local: struct LocalConfigData {
369
+ local: struct LocalConfigData <- LocalConfigInput {
370
370
/// Toggles the additional completions that automatically add imports when completed.
371
371
/// Note that your client must specify the `additionalTextEdits` LSP client capability to truly have this feature enabled.
372
372
completion_autoimport_enable: bool = true ,
@@ -583,7 +583,7 @@ config_data! {
583
583
}
584
584
585
585
config_data ! {
586
- client: struct ClientConfigData { }
586
+ client: struct ClientConfigData <- ClientConfigInput { }
587
587
}
588
588
589
589
impl Default for ConfigData {
@@ -2325,7 +2325,7 @@ macro_rules! _default_str {
2325
2325
2326
2326
macro_rules! _config_data {
2327
2327
// modname is for the tests
2328
- ( $modname: ident: struct $name: ident {
2328
+ ( $modname: ident: struct $name: ident <- $input : ident {
2329
2329
$(
2330
2330
$( #[ doc=$doc: literal] ) *
2331
2331
$field: ident $( | $alias: ident) * : $ty: ty = $( @$marker: ident: ) ? $default: expr,
@@ -2334,6 +2334,11 @@ macro_rules! _config_data {
2334
2334
#[ allow( non_snake_case) ]
2335
2335
#[ derive( Debug , Clone , Serialize ) ]
2336
2336
struct $name { $( $field: $ty, ) * }
2337
+
2338
+ #[ allow( non_snake_case) ]
2339
+ #[ derive( Debug , Clone , Serialize ) ]
2340
+ struct $input { $( $field: Option <$ty>, ) * }
2341
+
2337
2342
impl $name {
2338
2343
#[ allow( unused) ]
2339
2344
fn from_json( json: & mut serde_json:: Value , error_sink: & mut Vec <( String , serde_json:: Error ) >) -> $name {
@@ -2372,6 +2377,14 @@ macro_rules! _config_data {
2372
2377
} , ) *
2373
2378
] )
2374
2379
}
2380
+
2381
+ fn apply_input( & mut self , input: $input) {
2382
+ $(
2383
+ if let Some ( value) = input. $field {
2384
+ self . $field = value;
2385
+ }
2386
+ ) *
2387
+ }
2375
2388
}
2376
2389
2377
2390
mod $modname {
0 commit comments