"""
Sublime commands related to development and debugging.
"""

from sublime_plugin import WindowCommand

from ..util import debug, reload
from ...core.settings import GitSavvySettings

REPORT_URL_TEMPLATE = "https://github.com/timbrel/GitSavvy/issues/new?{q}"


class GsReloadModulesDebug(WindowCommand):

    """
    When triggered, reload all GitSavvy submodules.
    """

    def run(self):
        reload.reload_plugin()

    def is_visible(self):
        return GitSavvySettings().get("dev_mode")


class GsStartLoggingCommand(WindowCommand):

    """
    Starts recording all interactions with Git for reporting issues.
    """

    def run(self):
        debug.start_logging()


class GsStopLoggingCommand(WindowCommand):

    """
    Stops recording interactions with Git.
    """

    def run(self):
        debug.stop_logging()


class GsViewGitLog(WindowCommand):

    """
    Displays the recent recording.
    """

    def run(self):
        log = debug.get_log()
        view = self.window.new_file()
        view.set_scratch(True)
        view.settings().set("syntax", "Packages/JavaScript/JSON.sublime-syntax")
        view.run_command("gs_replace_view_text", {
            "text": log,
            "nuke_cursors": True
        })

@@ -178,16 +178,63 @@
 ettings%0A
+from ...core.view import replace_view_content%0A%0A
 %0AREPORT_
@@ -1180,116 +1180,36 @@
     
-view.run_command(%22gs_replace_view_text%22, %7B%0A            %22text%22: log,%0A            %22nuke_cursors%22: True%0A        %7D
+replace_view_content(view, log
 )%0A

Use `replace_view_content` in `debug.py`