diff --git a/commands/disable_linting.py b/commands/disable_linting.py index 8e0612c0..024c6663 100644 --- a/commands/disable_linting.py +++ b/commands/disable_linting.py @@ -15,20 +15,23 @@ class AnacondaDisableLinting(sublime_plugin.WindowCommand): def run(self) -> None: view = self.window.active_view() - if view.file_name() is not None: - ANACONDA['DISABLED'].append(view.file_name()) - else: - ANACONDA['DISABLED_BUFFERS'].append((self.window.id(), view.id())) - - erase_lint_marks(view) + window_view = (self.window.id(), view.id()) + filename = view.file_name() + if filename is not None and filename not in ANACONDA['DISABLED']: + ANACONDA['DISABLED'].append(filename) + erase_lint_marks(view) + elif filename is None and window_view not in ANACONDA['DISABLED_BUFFERS']: + ANACONDA['DISABLED_BUFFERS'].append(window_view) + erase_lint_marks(view) def is_enabled(self) -> bool: """Determines if the command is enabled """ view = self.window.active_view() + window_view = (self.window.id(), view.id()) if ((view.file_name() in ANACONDA['DISABLED'] - and view.id() in ANACONDA['DISABLED_BUFFERS']) + and window_view in ANACONDA['DISABLED_BUFFERS']) or not get_settings(view, 'anaconda_linting')): return False diff --git a/commands/enable_linting.py b/commands/enable_linting.py index 83ea1450..cbd5c79e 100644 --- a/commands/enable_linting.py +++ b/commands/enable_linting.py @@ -19,10 +19,10 @@ def run(self) -> None: filename = view.file_name() if filename is not None and filename in ANACONDA['DISABLED']: ANACONDA['DISABLED'].remove(filename) + run_linter(view) elif filename is None and window_view in ANACONDA['DISABLED_BUFFERS']: ANACONDA['DISABLED_BUFFERS'].remove(window_view) - - run_linter(self.window.active_view()) + run_linter(view) def is_enabled(self) -> bool: """Determines if the command is enabled