mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Don't use atom.config global in ScopedProperties
This commit is contained in:
committed by
Nathan Sobo
parent
b5fc710f15
commit
ff86eb6a59
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user