@@ -577,23 +577,24 @@ def run(self, edit):
577
577
"allowed_folders" : ["classes" , "triggers" ]
578
578
})
579
579
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
581
584
view = sublime .active_window ().active_view ()
582
-
583
- # Execute view_code_coverage command
584
585
view .run_command ("view_code_coverage" )
586
+ coverage_view = sublime .active_window ().active_view ()
585
587
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
588
591
589
- # Focus on the view of open code file
590
- # Close the view of open code file
591
592
if view .id () not in openViewIds :
592
593
sublime .active_window ().focus_view (view )
593
594
sublime .active_window ().run_command ("close" )
594
595
595
596
# Move focus to the coverage view
596
- sublime .active_window ().focus_view (coverageView )
597
+ sublime .active_window ().focus_view (coverage_view )
597
598
598
599
class NewViewCommand (sublime_plugin .TextCommand ):
599
600
"""
@@ -1615,7 +1616,7 @@ def run(self, view):
1615
1616
})
1616
1617
1617
1618
def is_enabled (self ):
1618
- return self .view .settings ().get ("is_debug_log" )
1619
+ return self .view .settings ().get ("is_debug_log" ) is True
1619
1620
1620
1621
class ExecuteQuery (sublime_plugin .TextCommand ):
1621
1622
def run (self , view ):
0 commit comments