示例#1
0
 def is_visible(self, launch_browser=False):
     if S.SESSION:
         return False
     if launch_browser and (config.get_value(S.KEY_LAUNCH_BROWSER)
                            or not config.get_value(S.KEY_URL)):
         return False
     return True
示例#2
0
 def is_visible(self, close_windows=False, launch_browser=False):
     if S.SESSION:
         if close_windows and config.get_value(S.KEY_CLOSE_ON_STOP):
             return False
         if launch_browser and (config.get_value(S.KEY_LAUNCH_BROWSER)
                                or not config.get_value(S.KEY_URL)):
             return False
         return True
     return False
示例#3
0
 def is_visible(self, restore=False, close_windows=False):
     if S.SESSION:
         return False
     disable_layout = config.get_value(S.KEY_DISABLE_LAYOUT)
     if close_windows and (not disable_layout or not V.has_debug_view()):
         return False
     if restore and disable_layout:
         return False
     if restore:
         try:
             return sublime.active_window().get_layout(
             ) == config.get_value(S.KEY_DEBUG_LAYOUT, S.LAYOUT_DEBUG)
         except:
             pass
     return True
示例#4
0
 def is_enabled(self, restore=False, close_windows=False):
     disable_layout = config.get_value(S.KEY_DISABLE_LAYOUT)
     if close_windows and (not disable_layout or not V.has_debug_view()):
         return False
     if restore and disable_layout:
         return False
     return True
示例#5
0
 def run(self, restore=False, close_windows=False, keymap=False):
     # Get active window
     window = sublime.active_window()
     # Do not restore layout or close windows while debugging
     if S.SESSION and (restore or close_windows or keymap):
         return
     # Set layout, unless user disabled debug layout
     if not config.get_value(S.KEY_DISABLE_LAYOUT):
         if restore or keymap:
             V.set_layout('normal')
         else:
             V.set_layout('debug')
     # Close all debugging related windows
     if close_windows or restore or keymap:
         V.close_debug_windows()
         return
     # Reset data in debugging related windows
     V.show_content(V.DATA_BREAKPOINT)
     V.show_content(V.DATA_CONTEXT)
     V.show_content(V.DATA_STACK)
     V.show_content(V.DATA_WATCH)
     panel = window.get_output_panel('xdebug')
     panel.run_command('xdebug_view_update')
     # Close output panel
     window.run_command('hide_panel', {'panel': 'output.xdebug'})
示例#6
0
    def run(self, launch_browser=False, restart=False):
        # Define new session with DBGp protocol
        S.SESSION = protocol.Protocol()
        S.SESSION_BUSY = False
        S.BREAKPOINT_EXCEPTION = None
        S.BREAKPOINT_ROW = None
        S.CONTEXT_DATA.clear()
        async_session = session.SocketHandler(session.ACTION_WATCH,
                                              check_watch_view=True)
        async_session.start()
        # Remove temporary breakpoint
        if S.BREAKPOINT_RUN is not None and S.BREAKPOINT_RUN[
                'filename'] in S.BREAKPOINT and S.BREAKPOINT_RUN[
                    'lineno'] in S.BREAKPOINT[S.BREAKPOINT_RUN['filename']]:
            self.window.active_view().run_command(
                'xdebug_breakpoint', {
                    'rows': [S.BREAKPOINT_RUN['lineno']],
                    'filename': S.BREAKPOINT_RUN['filename']
                })
        S.BREAKPOINT_RUN = None
        # Set debug layout
        self.window.run_command('xdebug_layout')
        # Launch browser
        if launch_browser or (config.get_value(S.KEY_LAUNCH_BROWSER)
                              and not restart):
            util.launch_browser()

        # Start thread which will run method that listens for response on configured port
        threading.Thread(target=self.listen).start()
示例#7
0
 def run(self, close_windows=False, launch_browser=False, restart=False):
     try:
         S.SESSION.clear()
     except:
         pass
     finally:
         S.SESSION = None
         S.SESSION_BUSY = False
         S.BREAKPOINT_EXCEPTION = None
         S.BREAKPOINT_ROW = None
         S.CONTEXT_DATA.clear()
         async_session = session.SocketHandler(session.ACTION_WATCH,
                                               check_watch_view=True)
         async_session.start()
         # Remove temporary breakpoint
         if S.BREAKPOINT_RUN is not None and S.BREAKPOINT_RUN[
                 'filename'] in S.BREAKPOINT and S.BREAKPOINT_RUN[
                     'lineno'] in S.BREAKPOINT[
                         S.BREAKPOINT_RUN['filename']]:
             self.window.active_view().run_command(
                 'xdebug_breakpoint', {
                     'rows': [S.BREAKPOINT_RUN['lineno']],
                     'filename': S.BREAKPOINT_RUN['filename']
                 })
         S.BREAKPOINT_RUN = None
     # Launch browser
     if launch_browser or (config.get_value(S.KEY_LAUNCH_BROWSER)
                           and not restart):
         util.launch_browser()
     # Close or reset debug layout
     if close_windows or config.get_value(S.KEY_CLOSE_ON_STOP):
         if config.get_value(S.KEY_DISABLE_LAYOUT):
             self.window.run_command('xdebug_layout',
                                     {'close_windows': True})
         else:
             self.window.run_command('xdebug_layout', {'restore': True})
     else:
         self.window.run_command('xdebug_layout')
     # Render breakpoint markers
     V.render_regions()
示例#8
0
import threading

# Load modules
try:
    from .xdebug import config, dbgp, load, protocol, session, util
    from .xdebug.helper import H
    from .xdebug import settings as S
    from .xdebug import view as V
except:
    from xdebug import config, dbgp, load, protocol, session, util
    from xdebug.helper import H
    from xdebug import settings as S
    from xdebug import view as V

# Set Python libraries from system installation
python_path = config.get_value(S.KEY_PYTHON_PATH)
if python_path:
    python_path = os.path.normpath(python_path.replace('\\', '/'))
    python_dynload = os.path.join(python_path, 'lib-dynload')
    if python_dynload not in sys.path:
        sys.path.append(python_dynload)

# Define path variables
try:
    S.PACKAGE_PATH = os.path.dirname(os.path.realpath(__file__))
    S.PACKAGE_FOLDER = os.path.basename(S.PACKAGE_PATH)
except:
    pass

# Initialize package
sublime.set_timeout(lambda: load.xdebug(), 1000)