@@ -406,31 +406,41 @@ class ConfigurationRegistry implements IConfigurationRegistry {
406
406
this . defaultLanguageConfigurationOverridesNode . properties ! [ key ] = property ;
407
407
} else {
408
408
const property = this . configurationProperties [ key ] ;
409
- let defaultValue = overrides [ key ] ;
410
- let defaultValueSource : ConfigurationDefaultValueSource | undefined = source ;
409
+
410
+ const existingDefaultOverride = this . configurationDefaultsOverrides . get ( key ) ;
411
+ let existingDefaultValue = existingDefaultOverride ?. value ?? property ?. defaultDefaultValue ;
412
+
413
+ let newDefaultValue = overrides [ key ] ;
414
+ let newDefaultValueSource : ConfigurationDefaultValueSource | undefined = source ;
415
+
416
+ const isObjectSetting = types . isObject ( newDefaultValue ) && (
417
+ property !== undefined && property . type === 'object' ||
418
+ property === undefined && ( types . isUndefined ( existingDefaultValue ) || types . isObject ( existingDefaultValue ) ) ) ;
411
419
412
420
// If the default value is an object, merge the objects and store the source of each keys
413
- if ( property . type === 'object' && types . isObject ( overrides [ key ] ) ) {
414
- const objectDefaults = this . configurationDefaultsOverrides . get ( key ) ;
415
- const existingDefaultValue = objectDefaults ?. value ?? property . defaultDefaultValue ?? { } ;
416
- defaultValue = { ...existingDefaultValue , ...overrides [ key ] } ;
421
+ if ( isObjectSetting ) {
422
+ if ( ! types . isObject ( existingDefaultValue ) ) {
423
+ existingDefaultValue = { } ;
424
+ }
425
+
426
+ newDefaultValue = { ...existingDefaultValue , ...newDefaultValue } ;
417
427
418
- defaultValueSource = objectDefaults ?. source ?? new Map < string , ConfigurationDefaultSource > ( ) ;
419
- if ( ! ( defaultValueSource instanceof Map ) ) {
428
+ newDefaultValueSource = existingDefaultOverride ?. source ?? new Map < string , ConfigurationDefaultSource > ( ) ;
429
+ if ( ! ( newDefaultValueSource instanceof Map ) ) {
420
430
console . error ( 'defaultValueSource is not a Map' ) ;
421
431
continue ;
422
432
}
423
433
424
- for ( const objectKey in overrides [ key ] ) {
434
+ for ( const overrideObjectKey in overrides [ key ] ) {
425
435
if ( source ) {
426
- defaultValueSource . set ( objectKey , source ) ;
436
+ newDefaultValueSource . set ( overrideObjectKey , source ) ;
427
437
} else {
428
- defaultValueSource . delete ( objectKey ) ;
438
+ newDefaultValueSource . delete ( overrideObjectKey ) ;
429
439
}
430
440
}
431
441
}
432
442
433
- this . configurationDefaultsOverrides . set ( key , { value : defaultValue , source : defaultValueSource } ) ;
443
+ this . configurationDefaultsOverrides . set ( key , { value : newDefaultValue , source : newDefaultValueSource } ) ;
434
444
435
445
if ( property ) {
436
446
this . updatePropertyDefaultValue ( key , property ) ;
0 commit comments