From bc76e29d471e994abe4d612eadf3b9d68869d04e Mon Sep 17 00:00:00 2001 From: Dean Shaff Date: Thu, 11 Feb 2021 08:16:06 -0600 Subject: [PATCH 1/2] make python grammar configurable --- lib/index.coffee | 3 +++ lib/python-autopep8.coffee | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/index.coffee b/lib/index.coffee index 7a98028..92dd884 100644 --- a/lib/index.coffee +++ b/lib/index.coffee @@ -11,6 +11,9 @@ module.exports = maxLineLength: type: 'integer' default: 100 + grammars: + type: 'array' + default: ["Python"] cmdLineOptions: type: 'array' default: [] diff --git a/lib/python-autopep8.coffee b/lib/python-autopep8.coffee index d139280..d865470 100644 --- a/lib/python-autopep8.coffee +++ b/lib/python-autopep8.coffee @@ -8,8 +8,9 @@ class PythonAutopep8 editor = atom.workspace.getActiveTextEditor() if not editor? return false - grammar = editor.getGrammar().name - return grammar == 'Python' or grammar == 'MagicPython' + grammarNames = atom.config.get "python-autopep8.grammars" + grammarName = editor.getGrammar().name + return grammarName in grammarNames removeStatusbarItem: => @statusBarTile?.destroy() @@ -42,6 +43,7 @@ class PythonAutopep8 format: -> if not @checkForPythonContext() + @updateStatusbarText("x", true) return cmd = atom.config.get "python-autopep8.autopep8Path" From 62d6ca042f3080cd285b6c57757fbf20ecaf6f5a Mon Sep 17 00:00:00 2001 From: Dean Shaff Date: Thu, 11 Feb 2021 08:17:47 -0600 Subject: [PATCH 2/2] add MagicPython to default grammars --- lib/index.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/index.coffee b/lib/index.coffee index 92dd884..7ae6508 100644 --- a/lib/index.coffee +++ b/lib/index.coffee @@ -13,7 +13,7 @@ module.exports = default: 100 grammars: type: 'array' - default: ["Python"] + default: ["Python", "MagicPython"] cmdLineOptions: type: 'array' default: []