Fix to send parser to prettier API properly

This commit is contained in:
Steven Zeck 2018-03-06 12:01:25 -06:00
parent 065713809c
commit d5cceaf071
No known key found for this signature in database
GPG Key ID: 621B374B29AA814A
1 changed files with 2 additions and 1 deletions

View File

@ -31,6 +31,7 @@ module.exports = class Prettier extends Beautifier
prettierLanguage = _.find(prettier.getSupportInfo().languages, 'name': language) prettierLanguage = _.find(prettier.getSupportInfo().languages, 'name': language)
if prettierLanguage if prettierLanguage
parser = prettierLanguage.parsers[0] parser = prettierLanguage.parsers[0]
options.parser = parser
else else
reject(new Error("Unknown language for Prettier")) reject(new Error("Unknown language for Prettier"))
@ -38,7 +39,7 @@ module.exports = class Prettier extends Beautifier
try try
prettier.resolveConfig(filePath).then((configOptions) -> prettier.resolveConfig(filePath).then((configOptions) ->
result = prettier.format(text, configOptions or options, parser) result = prettier.format(text, configOptions or options)
prettier.clearConfigCache() prettier.clearConfigCache()
resolve result resolve result
) )