       return true if b[0] == 'jsx'
     false
 
+  isReactEnabledForEditor: (editor) ->
+    return editor? && editor.getGrammar().scopeName == "source.js.jsx"
+
   autoSetGrammar: (editor) ->
-    return if editor.getGrammar().scopeName == "source.js.jsx"
+    return if @isReactEnabledForEditor editor
 
     path = require 'path'
 


    editor = atom.workspace.getActiveEditor()

    return if not editor?

    selections = editor.getSelections()



    editor = atom.workspace.getActiveEditor()

    return if not @isReactEnabledForEditor editor

    selections = editor.getSelections()
    editor.transact =>
