It seems as though I am shooting my mouth off again.
I have been pushing some code around, which caused me to doubt my earlier comment.
I am going to start a new topic to get clarification on what I expected vs what the result is.
To show that I have tried something, the coding idea follows. Note that it is a mute point. It seems as though we do not have to check when the
dispatch is done.
waitTask = false # global scope
taskDone = (event) ->
return false unless waitTask
return false unless event.type is 'atom-beautify:beautify-editor'
# Restoring the earlier grammar
waitTask = false
_editor = atom.workspace.getActiveTextEditor()
console.log "HTML (EEx) Beautified successfully"
atom.commands.add 'atom-text-editor', 'custom:beautify', ->
# Check: text editor is active and concerned grammar scope
return false unless _editor = atom.workspace.getActiveTextEditor()
return false unless _editor.getGrammar().scopeName is 'text.html.elixir'
# Change grammar
# Need to check if task was completed as expected
waitTask = true
# Trigger "beautify" task
onDidDispatch() is now called before
dispatch… this seem to work now.
Still doubtful if this step is required or not.