Fix config.get for schemas containing objects

The config.get method would not return the default values for the
properties in objects. Now with _.deepExtends, the default values are
the base while any new values overwrite the defaults. This way all
default values appear, including those nested in an object. This fixes
atom/settings-view#386 and fixes atom/settings-view#518.
This commit is contained in:
Jeremy Ebneyamin
2015-08-22 18:42:16 -07:00
committed by Jeremy Ramin
parent 4560914273
commit f2c9688b43

View File

@@ -864,8 +864,8 @@ class Config
defaultValue = _.valueForKeyPath(@defaultSettings, keyPath)
if value?
value = @deepClone(value)
_.defaults(value, defaultValue) if isPlainObject(value) and isPlainObject(defaultValue)
defaultValue = @deepClone(defaultValue)
value = _.deepExtends(defaultValue, value) if isPlainObject(value) and isPlainObject(defaultValue)
else
value = @deepClone(defaultValue)