Skip to content

Commit

Permalink
See #237. Fix bug in Debug command when Text Editor not selected
Browse files Browse the repository at this point in the history
  • Loading branch information
Glavin001 committed Mar 16, 2015
1 parent d91421b commit 114e67a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/beautify.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,13 @@ beautifyDirectory = ({target}) ->

debug = () ->

# Get current editor
editor = atom.workspace.getActiveTextEditor()
# Check if there is an active editor
if not editor?
return confirm("Active Editor not found.\n"+
"Please select a Text Editor first to beautify.")

return unless confirm('Are you ready to debug Atom Beautify?\n\n'+
'Warning: This will change your current clipboard contents.')

Expand Down Expand Up @@ -243,12 +250,6 @@ debug = () ->
addHeader(2, "Original file to be beautified")

# Original file
# Get current editor
editor = atom.workspace.getActiveTextEditor()
# Check if there is an active editor
if not editor?
return showError(new Error("Active Editor not found.\n"
"Please select a Text Editor first to beautify."))

# Get editor path and configurations for paths
filePath = editor.getPath()
Expand Down

0 comments on commit 114e67a

Please sign in to comment.