Fix changes from review of #1212.

This commit is contained in:
Glavin Wiechert 2016-12-30 01:55:33 -04:00
parent 55216a8cef
commit 4b1a1a8292
1 changed files with 14 additions and 6 deletions

View File

@ -10,13 +10,21 @@ module.exports = class HhFormat extends Beautifier
link: "http://hhvm.com/"
options:
PHP: true
PHP: false
beautify: (text, language, options) ->
@run("hh_format", [
@tempFile("input", text)
]).then((output) =>
# hh_format can exit with status 0 and no output for some files which
# it doesn't format. In that case we just return original text.
if output.trim() then output else text
)
],
{
help: {
link: "http://hhvm.com/"
}
}).then((output) ->
# hh_format can exit with status 0 and no output for some files which
# it doesn't format. In that case we just return original text.
if output.trim()
output
else
@Promise.resolve(new Error("hh_format returned an empty output."))
)