diff --git a/lib/python-isort.coffee b/lib/python-isort.coffee index 8ffb600..749000a 100644 --- a/lib/python-isort.coffee +++ b/lib/python-isort.coffee @@ -1,4 +1,4 @@ -fs = require 'fs' +fs = require 'fs-plus' $ = require 'jquery' process = require 'child_process' @@ -9,7 +9,7 @@ class PythonIsort editor = atom.workspace.getActiveTextEditor() if not editor? return false - return editor.getGrammar().name == 'Python' + return editor.getGrammar().scopeName == 'source.python' removeStatusbarItem: => @statusBarTile?.destroy() @@ -44,8 +44,8 @@ class PythonIsort if not @checkForPythonContext() return - params = [@getFilePath(), "-c", "-vb"] - isortpath = atom.config.get "python-isort.isortPath" + params = ["-ns", @getFilePath(), @getFilePath(), "-c", "-vb"] + isortpath = fs.normalize(atom.config.get "python-isort.isortPath") which = process.spawnSync('which', ['isort']).status if which == 1 and not fs.existsSync(isortpath) @@ -65,8 +65,8 @@ class PythonIsort if not @checkForPythonContext() return - params = [@getFilePath(), "-vb"] - isortpath = atom.config.get "python-isort.isortPath" + params = ["-ns", @getFilePath(), @getFilePath(), "-vb"] + isortpath = fs.normalize(atom.config.get "python-isort.isortPath") which = process.spawnSync('which', ['isort']).status if which == 1 and not fs.existsSync(isortpath) diff --git a/package.json b/package.json index 9c554c8..b303dde 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "atom": ">=0.185.0 <2.0.0" }, "dependencies": { + "fs-plus": "^2.8.1", "jquery": "^2.1.4" } }