diff --git a/package.json b/package.json index 0e957fd26..f0770e82e 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "random-words": "0.0.1", "runas": "0.5.x", "scandal": "0.15.0", - "scoped-property-store": "^0.4.0", + "scoped-property-store": "^0.5.0", "scrollbar-style": "^0.1.0", "season": ">=1.0.2 <2.0", "semver": "1.1.4", diff --git a/src/syntax.coffee b/src/syntax.coffee index 793d070b2..c2d1b22bb 100644 --- a/src/syntax.coffee +++ b/src/syntax.coffee @@ -3,6 +3,7 @@ _ = require 'underscore-plus' {Subscriber} = require 'emissary' {GrammarRegistry, ScopeSelector} = require 'first-mate' ScopedPropertyStore = require 'scoped-property-store' +PropertyAccessors = require 'property-accessors' {$, $$} = require './space-pen-extensions' Token = require './token' @@ -15,6 +16,7 @@ Token = require './token' # language-specific comment regexes. module.exports = class Syntax extends GrammarRegistry + PropertyAccessors.includeInto(this) Subscriber.includeInto(this) atom.deserializers.add(this) @@ -25,25 +27,28 @@ class Syntax extends GrammarRegistry constructor: -> super - @scopedProperties = new ScopedPropertyStore + @propertyStore = new ScopedPropertyStore serialize: -> {deserializer: @constructor.name, @grammarOverridesByPath} createToken: (value, scopes) -> new Token({value, scopes}) + # Deprecated: Used by settings-view to display snippets for packages + @::accessor 'scopedProperties', -> @propertyStore.propertySets + addProperties: (args...) -> name = args.shift() if args.length > 2 [selector, properties] = args propertiesBySelector = {} propertiesBySelector[selector] = properties - @scopedProperties.addProperties(name, propertiesBySelector) + @propertyStore.addProperties(name, propertiesBySelector) removeProperties: (name) -> - @scopedProperties.removeProperties(name) + @propertyStore.removeProperties(name) clearProperties: -> - @scopedProperties = new ScopedPropertyStore + @propertyStore = new ScopedPropertyStore # Public: Get a property for the given scope and key path. # @@ -63,7 +68,7 @@ class Syntax extends GrammarRegistry scope = ".#{scope}" unless scope.indexOf('.') is 0 scope .join(' ') - @scopedProperties.getPropertyValue(scopeChain, keyPath) + @propertyStore.getPropertyValue(scopeChain, keyPath) propertiesForScope: (scope, keyPath) -> scopeChain = scope @@ -72,7 +77,7 @@ class Syntax extends GrammarRegistry scope .join(' ') - @scopedProperties.getProperties(scopeChain, keyPath) + @propertyStore.getProperties(scopeChain, keyPath) cssSelectorFromScopeSelector: (scopeSelector) -> new ScopeSelector(scopeSelector).toCssSelector()