From 50172154c5571f14711072d6d96d0b2a0d35fad6 Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Tue, 20 Feb 2018 16:23:53 -0600 Subject: [PATCH] Use path and context to retrieve the directory --- src/beautifiers/prettier.coffee | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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) ->