From 6336ffbf449debcd8d149f419a4cb5d945f71aa7 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 23 Jun 2014 16:22:37 -0700 Subject: [PATCH] Store included grammar scopes --- src/atom.coffee | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/atom.coffee b/src/atom.coffee index 4c3302ab5..79321a19b 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -252,9 +252,19 @@ class Atom extends Model storeGrammarsForOpenEditors: -> packageNames = [] - for editor in @workspace.getEditors() - {packageName} = editor.getGrammar() - packageNames.push(packageName) if packageName + addGrammar = (grammar={}) -> + {includedGrammarScopes, packageName} = grammar + return unless packageName + + # Prevent cycles + return if packageNames.indexOf(packageName) isnt -1 + + packageNames.push(packageName) + for scopeName in includedGrammarScopes ? [] + console.log scopeName + addGrammar(atom.syntax.grammarForScopeName(scopeName)) + + addGrammar(editor.getGrammar()) for editor in @workspace.getEditors() @state.packagesWithActiveGrammars = _.uniq(packageNames) # Public: Get the load settings for the current window.