           bufStart = selection.getBufferRange().serialize()[0]
           jsxformat.setOptions({});
           result = jsxformat.format(selection.getText())
-          selection.insertText(result, {autoIndent: true});
+          selection.insertText(result, autoIndent: true);
           editor.setCursorBufferPosition(bufStart)
         catch err
           # Parsing/formatting the selection failed lets try to parse the whole file but format the selection only

    @patchEditorLangModeSuggestedIndentForBufferRow(editor)
    @patchEditorLangModeAutoDecreaseIndentForBufferRow(editor)

  autoSetGrammar: (editor) ->
    # Check if file extension is .jsx or the file has the old JSX notation
    if path.extname(editor.getPath()) is ".jsx" or isJSX(editor.getText())
      jsxGrammar = atom.syntax.grammarsByScopeName["source.js.jsx"]
      editor.setGrammar jsxGrammar if jsxGrammar

  onHTMLToJSX: ->
    jsxformat = require 'jsxformat'
    HTMLtoJSX = require './lib/htmltojsx'
    converter = new HTMLtoJSX({
      createClass: false
    })

    editor = atom.workspace.getActiveEditor()
    selections = editor.getSelections()

    editor.transact =>

    atom.config.set("react.decreaseIndentForNextLinePattern", decreaseIndentForNextLinePattern)

    # Bind events
    atom.commands.add 'atom-workspace', 'react:reformat-JSX', @onReformat
    atom.commands.add 'atom-workspace', 'react:HTML-to-JSX', @onHTMLToJSX

    atom.workspace.observeTextEditors @processEditor.bind(this)

module.exports = new AtomReact
