mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Add isActive() helper to Package
This commit is contained in:
@@ -22,3 +22,6 @@ class Package
|
||||
|
||||
constructor: (@path) ->
|
||||
@name = basename(@path)
|
||||
|
||||
isActive: ->
|
||||
atom.isPackageActive(@name)
|
||||
|
||||
@@ -23,7 +23,7 @@ class TextMatePackage extends Package
|
||||
@syntaxesPath = fsUtils.join(@path, "Syntaxes")
|
||||
@grammars = []
|
||||
@scopedProperties = []
|
||||
@metadata = {@name, version: '0.0.0'}
|
||||
@metadata = {@name, version: '-1'}
|
||||
|
||||
load: ({sync}={}) ->
|
||||
if sync
|
||||
@@ -75,7 +75,7 @@ class TextMatePackage extends Package
|
||||
|
||||
addGrammar: (grammar) ->
|
||||
@grammars.push(grammar)
|
||||
syntax.addGrammar(grammar) if atom.isPackageActive(@path)
|
||||
syntax.addGrammar(grammar) if @isActive()
|
||||
|
||||
getGrammars: -> @grammars
|
||||
|
||||
@@ -110,7 +110,7 @@ class TextMatePackage extends Package
|
||||
scopedProperties.push({selector, properties})
|
||||
|
||||
@scopedProperties = scopedProperties
|
||||
if atom.isPackageActive(@path)
|
||||
if @isActive()
|
||||
for {selector, properties} in @scopedProperties
|
||||
syntax.addProperties(@path, selector, properties)
|
||||
@loadTextMatePreferenceObjects(preferenceObjects, done)
|
||||
|
||||
Reference in New Issue
Block a user