Don't use atom.config global in ScopedProperties

This commit is contained in:
Antonio Scandurra
2015-10-06 19:59:20 +02:00
committed by Nathan Sobo
parent b5fc710f15
commit ff86eb6a59
2 changed files with 6 additions and 6 deletions

View File

@@ -307,7 +307,7 @@ class Package
@settings = []
loadSettingsFile = (settingsPath, callback) =>
ScopedProperties.load settingsPath, (error, settings) =>
ScopedProperties.load settingsPath, @config, (error, settings) =>
if error?
detail = "#{error.message} in #{settingsPath}"
stack = "#{error.stack}\n at #{settingsPath}:1:1"

View File

@@ -3,21 +3,21 @@ CSON = require 'season'
module.exports =
class ScopedProperties
@load: (scopedPropertiesPath, callback) ->
@load: (scopedPropertiesPath, config, callback) ->
CSON.readFile scopedPropertiesPath, (error, scopedProperties={}) ->
if error?
callback(error)
else
callback(null, new ScopedProperties(scopedPropertiesPath, scopedProperties))
callback(null, new ScopedProperties(scopedPropertiesPath, scopedProperties, config))
constructor: (@path, @scopedProperties) ->
constructor: (@path, @scopedProperties, @config) ->
activate: ->
for selector, properties of @scopedProperties
atom.config.set(null, properties, scopeSelector: selector, source: @path)
@config.set(null, properties, scopeSelector: selector, source: @path)
return
deactivate: ->
for selector of @scopedProperties
atom.config.unset(null, scopeSelector: selector, source: @path)
@config.unset(null, scopeSelector: selector, source: @path)
return