parent
803c35dfa4
commit
db5469b73e
|
@ -124,7 +124,7 @@
|
||||||
"coffee-formatter": "^0.1.2",
|
"coffee-formatter": "^0.1.2",
|
||||||
"coffee-script": "^1.10.0",
|
"coffee-script": "^1.10.0",
|
||||||
"csscomb": "^3.1.7",
|
"csscomb": "^3.1.7",
|
||||||
"diff": "^3.0.0",
|
"diff": "3.0.0",
|
||||||
"editorconfig": "^0.13.2",
|
"editorconfig": "^0.13.2",
|
||||||
"event-kit": "^2.1.0",
|
"event-kit": "^2.1.0",
|
||||||
"expand-home-dir": "0.0.3",
|
"expand-home-dir": "0.0.3",
|
||||||
|
|
|
@ -281,7 +281,7 @@ beautifyDirectory = ({target}) ->
|
||||||
return
|
return
|
||||||
|
|
||||||
debug = () ->
|
debug = () ->
|
||||||
|
try
|
||||||
open = require("open")
|
open = require("open")
|
||||||
fs ?= require "fs"
|
fs ?= require "fs"
|
||||||
GitHubApi = require("github")
|
GitHubApi = require("github")
|
||||||
|
@ -367,7 +367,7 @@ debug = () ->
|
||||||
addInfo('Selected Beautifier', selectedBeautifier.name)
|
addInfo('Selected Beautifier', selectedBeautifier.name)
|
||||||
|
|
||||||
# Get current editor's text
|
# Get current editor's text
|
||||||
text = editor.getText()
|
text = editor.getText() or ""
|
||||||
|
|
||||||
# Contents
|
# Contents
|
||||||
codeBlockSyntax = (language?.name ? grammarName).toLowerCase().split(' ')[0]
|
codeBlockSyntax = (language?.name ? grammarName).toLowerCase().split(' ')[0]
|
||||||
|
@ -450,8 +450,9 @@ debug = () ->
|
||||||
addInfo('Beautified File Contents', "\n```#{codeBlockSyntax}\n#{result}\n```")
|
addInfo('Beautified File Contents', "\n```#{codeBlockSyntax}\n#{result}\n```")
|
||||||
# Diff
|
# Diff
|
||||||
JsDiff = require('diff')
|
JsDiff = require('diff')
|
||||||
diff = JsDiff.createPatch(filePath, text, \
|
if typeof result is "string"
|
||||||
result, "original", "beautified")
|
diff = JsDiff.createPatch(filePath or "", text or "", \
|
||||||
|
result or "", "original", "beautified")
|
||||||
addInfo('Original vs. Beautified Diff', "\n```#{codeBlockSyntax}\n#{diff}\n```")
|
addInfo('Original vs. Beautified Diff', "\n```#{codeBlockSyntax}\n#{diff}\n```")
|
||||||
|
|
||||||
addHeader(3, "Logs")
|
addHeader(3, "Logs")
|
||||||
|
@ -514,6 +515,19 @@ debug = () ->
|
||||||
catch e
|
catch e
|
||||||
return cb(e)
|
return cb(e)
|
||||||
)
|
)
|
||||||
|
.catch((error) ->
|
||||||
|
stack = error.stack
|
||||||
|
detail = error.description or error.message
|
||||||
|
atom?.notifications?.addError(error.message, {
|
||||||
|
stack, detail, dismissable : true
|
||||||
|
})
|
||||||
|
)
|
||||||
|
catch error
|
||||||
|
stack = error.stack
|
||||||
|
detail = error.description or error.message
|
||||||
|
atom?.notifications?.addError(error.message, {
|
||||||
|
stack, detail, dismissable : true
|
||||||
|
})
|
||||||
|
|
||||||
handleSaveEvent = ->
|
handleSaveEvent = ->
|
||||||
atom.workspace.observeTextEditors (editor) ->
|
atom.workspace.observeTextEditors (editor) ->
|
||||||
|
|
Loading…
Reference in New Issue