Don’t return schema defaults when sources are specified in Config::get

This commit is contained in:
Nathan Sobo
2014-12-12 09:13:57 -07:00
committed by Max Brunsfeld
parent 73df017d83
commit c35fb90653
2 changed files with 3 additions and 2 deletions

View File

@@ -44,7 +44,8 @@ describe "Config", ->
expect(atom.config.get("x.y", sources: ["a"], scope: [".foo"])).toBe 1
expect(atom.config.get("x.y", sources: ["b"], scope: [".foo"])).toBe 2
expect(atom.config.get("x.y", sources: ["c"], scope: [".foo"])).toBe 3
expect(atom.config.get("x.y", sources: ["x"], scope: [".foo"])).toBe 4
# Schema defaults never match a specific source. We could potentially add a special "schema" source.
expect(atom.config.get("x.y", sources: ["x"], scope: [".foo"])).toBeUndefined()
describe "when an 'excludeSources' option is specified", ->
it "only retrieves values from the specified sources", ->

View File

@@ -808,7 +808,7 @@ class Config
getRawValue: (keyPath, options) ->
value = _.valueForKeyPath(@settings, keyPath)
defaultValue = _.valueForKeyPath(@defaultSettings, keyPath)
defaultValue = _.valueForKeyPath(@defaultSettings, keyPath) unless options?.sources?.length > 0
if value?
value = _.deepClone(value)