diff --git a/spec/app/atom-spec.coffee b/spec/app/atom-spec.coffee index 2bb8af19f..bc05d7408 100644 --- a/spec/app/atom-spec.coffee +++ b/spec/app/atom-spec.coffee @@ -177,6 +177,12 @@ describe "the `atom` global", -> expect(stylesheetElementForId(two)).not.toExist() expect(stylesheetElementForId(three)).not.toExist() + it "removes the package's scoped-properties", -> + atom.activatePackage("package-with-scoped-properties") + expect(syntax.getProperty ['.source.omg'], 'editor.increaseIndentPattern').toBe '^a' + atom.deactivatePackage("package-with-scoped-properties") + expect(syntax.getProperty ['.source.omg'], 'editor.increaseIndentPattern').toBeUndefined() + describe "texmate packages", -> it "removes the package's grammars", -> expect(syntax.selectGrammar("file.rb").name).toBe "Null Grammar" diff --git a/src/app/atom-package.coffee b/src/app/atom-package.coffee index 4820d94a0..6adf60953 100644 --- a/src/app/atom-package.coffee +++ b/src/app/atom-package.coffee @@ -11,6 +11,7 @@ class AtomPackage extends Package keymaps: null stylesheets: null grammars: null + scopedProperties: null mainModulePath: null resolvedMainModulePath: false mainModule: null @@ -35,6 +36,7 @@ class AtomPackage extends Package keymap.add(path, map) for [path, map] in @keymaps applyStylesheet(path, content) for [path, content] in @stylesheets syntax.addGrammar(grammar) for grammar in @grammars + syntax.addProperties(path, selector, properties) for [path, selector, properties] in @scopedProperties if @deferActivation and not immediate @subscribeToActivationEvents() @@ -81,10 +83,11 @@ class AtomPackage extends Package @grammars.push(TextMateGrammar.loadSync(grammarPath)) loadScopedProperties: -> + @scopedProperties = [] scopedPropertiessDirPath = fsUtils.join(@path, 'scoped-properties') for scopedPropertiesPath in fsUtils.list(scopedPropertiessDirPath, ['.cson', '.json']) ? [] for selector, properties of fsUtils.readObject(scopedPropertiesPath) - syntax.addProperties(selector, properties) + @scopedProperties.push([scopedPropertiesPath, selector, properties]) serialize: -> try @@ -94,6 +97,7 @@ class AtomPackage extends Package deactivate: -> syntax.removeGrammar(grammar) for grammar in @grammars + syntax.removeProperties(path) for [path] in @scopedProperties keymap.remove(path) for [path] in @keymaps removeStylesheet(path) for [path] in @stylesheets @mainModule?.deactivate?()