diff --git a/src/beautifiers/prettier.coffee b/src/beautifiers/prettier.coffee index bd2d12a..6d5c4e1 100644 --- a/src/beautifiers/prettier.coffee +++ b/src/beautifiers/prettier.coffee @@ -2,6 +2,7 @@ Beautifier = require('./beautifier') prettier = require("prettier") +path = require("path") module.exports = class Prettier extends Beautifier name: "Prettier" @@ -23,7 +24,7 @@ module.exports = class Prettier extends Beautifier Markdown: false } - beautify: (text, language, options) -> + beautify: (text, language, options, context) -> return new @Promise((resolve, reject) -> _ = require('lodash') @@ -33,7 +34,7 @@ module.exports = class Prettier extends Beautifier else reject(new Error("Unknown language for Prettier")) - filePath = atom.workspace.getActiveTextEditor().getPath() + filePath = context.filePath and path.dirname context.filePath try prettier.resolveConfig(filePath).then((configOptions) ->