From 5e713c8fa7f8f3dff04c5cd7db8d2fe85e3a9e76 Mon Sep 17 00:00:00 2001 From: lexicalunit Date: Tue, 16 Feb 2016 09:44:42 -0600 Subject: [PATCH 1/3] Support MagicPython grammar. --- lib/python-isort.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/python-isort.coffee b/lib/python-isort.coffee index 8ffb600..5c9cce6 100644 --- a/lib/python-isort.coffee +++ b/lib/python-isort.coffee @@ -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() From baeeeb07e8cdc38b1175c64171f41d556c016eb0 Mon Sep 17 00:00:00 2001 From: lexicalunit Date: Wed, 17 Feb 2016 13:46:53 -0600 Subject: [PATCH 2/3] Forces no-skip mode. --- lib/python-isort.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/python-isort.coffee b/lib/python-isort.coffee index 5c9cce6..2290876 100644 --- a/lib/python-isort.coffee +++ b/lib/python-isort.coffee @@ -44,7 +44,7 @@ class PythonIsort if not @checkForPythonContext() return - params = [@getFilePath(), "-c", "-vb"] + params = ["-ns", @getFilePath(), @getFilePath(), "-c", "-vb"] isortpath = atom.config.get "python-isort.isortPath" which = process.spawnSync('which', ['isort']).status @@ -65,7 +65,7 @@ class PythonIsort if not @checkForPythonContext() return - params = [@getFilePath(), "-vb"] + params = ["-ns", @getFilePath(), @getFilePath(), "-vb"] isortpath = atom.config.get "python-isort.isortPath" which = process.spawnSync('which', ['isort']).status From 64bfc99cc2a7219b8d46dc1001db5b67750cc65f Mon Sep 17 00:00:00 2001 From: lexicalunit Date: Wed, 17 Feb 2016 13:58:22 -0600 Subject: [PATCH 3/3] Normalize fs path. --- lib/python-isort.coffee | 6 +++--- package.json | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/python-isort.coffee b/lib/python-isort.coffee index 2290876..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' @@ -45,7 +45,7 @@ class PythonIsort return params = ["-ns", @getFilePath(), @getFilePath(), "-c", "-vb"] - isortpath = atom.config.get "python-isort.isortPath" + isortpath = fs.normalize(atom.config.get "python-isort.isortPath") which = process.spawnSync('which', ['isort']).status if which == 1 and not fs.existsSync(isortpath) @@ -66,7 +66,7 @@ class PythonIsort return params = ["-ns", @getFilePath(), @getFilePath(), "-vb"] - isortpath = atom.config.get "python-isort.isortPath" + 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" } }