Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions commands/disable_linting.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions commands/enable_linting.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down