Skip to content

Commit f3d6e2f

Browse files
committed
Fix some bugs for viewing code coverage and View Debug Only
1 parent 220a072 commit f3d6e2f

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

main.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -577,23 +577,24 @@ def run(self, edit):
577577
"allowed_folders": ["classes", "triggers"]
578578
})
579579

580-
# Get the view of open code file
580+
# 1. Open the view of related code file
581+
# 2. Run command `view_code_coverage` to open coverage view
582+
# 3. Close the view of related code file
583+
# 4. Focus on the coverage view
581584
view = sublime.active_window().active_view()
582-
583-
# Execute view_code_coverage command
584585
view.run_command("view_code_coverage")
586+
coverage_view = sublime.active_window().active_view()
585587

586-
# Get the coverage view
587-
coverageView = sublime.active_window().active_view()
588+
# If there is no available code file
589+
if coverage_view.id() == view.id():
590+
return
588591

589-
# Focus on the view of open code file
590-
# Close the view of open code file
591592
if view.id() not in openViewIds:
592593
sublime.active_window().focus_view(view)
593594
sublime.active_window().run_command("close")
594595

595596
# Move focus to the coverage view
596-
sublime.active_window().focus_view(coverageView)
597+
sublime.active_window().focus_view(coverage_view)
597598

598599
class NewViewCommand(sublime_plugin.TextCommand):
599600
"""
@@ -1615,7 +1616,7 @@ def run(self, view):
16151616
})
16161617

16171618
def is_enabled(self):
1618-
return self.view.settings().get("is_debug_log")
1619+
return self.view.settings().get("is_debug_log") is True
16191620

16201621
class ExecuteQuery(sublime_plugin.TextCommand):
16211622
def run(self, view):

0 commit comments

Comments
 (0)