From 114e67a2788d75ff1952f1fc89a36f61ff8f5aeb Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Mon, 16 Mar 2015 10:37:19 -0300 Subject: [PATCH] See #237. Fix bug in Debug command when Text Editor not selected --- lib/beautify.coffee | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/beautify.coffee b/lib/beautify.coffee index ca2981d16..e543eb1bb 100644 --- a/lib/beautify.coffee +++ b/lib/beautify.coffee @@ -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.') @@ -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()