From 201575f6152597276843b6b4b76d6c7489784130 Mon Sep 17 00:00:00 2001 From: Jason Kane Date: Mon, 10 May 2021 08:29:02 -0700 Subject: [PATCH] Address some sublime2 compatibility issues found by @ariswang92 --- PyYapf.py | 11 +++++++---- PyYapf.sublime-settings | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/PyYapf.py b/PyYapf.py index 9259d95..02a74ed 100644 --- a/PyYapf.py +++ b/PyYapf.py @@ -202,10 +202,13 @@ def find_yapf(self): # default to what is in the settings file cmd = self.get_setting("yapf_command") cmd = os.path.expanduser(cmd) - cmd = sublime.expand_variables( - cmd, - sublime.active_window().extract_variables() - ) + + # sublime 2.x support per https://github.com/jason-kane/PyYapf/issues/53 + if hasattr(sublime, "expand_variables"): + cmd = sublime.expand_variables( + cmd, + sublime.active_window().extract_variables() + ) save_settings = not cmd diff --git a/PyYapf.sublime-settings b/PyYapf.sublime-settings index 0f94513..e7f8eff 100644 --- a/PyYapf.sublime-settings +++ b/PyYapf.sublime-settings @@ -9,7 +9,7 @@ "on_save": false, // ignore files matching glob(s) - "onsave_ignore_fn_glob": ["*.pyx", ], + "onsave_ignore_fn_glob": ["*.pyx"], // report errors in popup dialog (in addition to status bar) "popup_errors": false,