Пример #1
0
  def _SetUpUI( self ):
    vim.command( 'tab split' )
    self._uiTab = vim.current.tabpage

    # Code window
    code_window = vim.current.window
    self._codeView = code.CodeView( code_window, self._api_prefix )

    # Call stack
    vim.command(
      f'topleft vertical { settings.Int( "sidebar_width", 50 ) }new' )
    stack_trace_window = vim.current.window
    one_third = int( vim.eval( 'winheight( 0 )' ) ) / 3
    self._stackTraceView = stack_trace.StackTraceView( self,
                                                       self._connection,
                                                       stack_trace_window )

    # Watches
    vim.command( 'leftabove new' )
    watch_window = vim.current.window

    # Variables
    vim.command( 'leftabove new' )
    vars_window = vim.current.window

    with utils.LetCurrentWindow( vars_window ):
      vim.command( f'{ one_third }wincmd _' )
    with utils.LetCurrentWindow( watch_window ):
      vim.command( f'{ one_third }wincmd _' )
    with utils.LetCurrentWindow( stack_trace_window ):
      vim.command( f'{ one_third }wincmd _' )

    self._variablesView = variables.VariablesView( self._connection,
                                                   vars_window,
                                                   watch_window )

    # Output/logging
    vim.current.window = code_window
    vim.command( f'rightbelow { settings.Int( "bottombar_height", 10 ) }new' )
    output_window = vim.current.window
    self._outputView = output.OutputView( self._connection,
                                          output_window,
                                          self._api_prefix )

    # TODO: If/when we support multiple sessions, we'll need some way to
    # indicate which tab was created and store all the tabs
    vim.vars[ 'vimspector_session_windows' ] = {
      'tabpage': self._uiTab.number,
      'code': utils.WindowID( code_window, self._uiTab ),
      'stack_trace': utils.WindowID( stack_trace_window, self._uiTab ),
      'variables': utils.WindowID( vars_window, self._uiTab ),
      'watches': utils.WindowID( watch_window, self._uiTab ),
      'output': utils.WindowID( output_window, self._uiTab ),
    }
    with utils.RestoreCursorPosition():
      with utils.RestoreCurrentWindow():
        with utils.RestoreCurrentBuffer( vim.current.window ):
          vim.command( 'doautocmd User VimspectorUICreated' )
Пример #2
0
  def _SetUpUIVertical( self ):
    # Code window
    code_window = vim.current.window
    self._codeView = code.CodeView( code_window, self._api_prefix )

    # Call stack
    vim.command(
      f'topleft { settings.Int( "topbar_height" ) }new' )
    stack_trace_window = vim.current.window
    one_third = int( vim.eval( 'winwidth( 0 )' ) ) / 3
    self._stackTraceView = stack_trace.StackTraceView( self,
                                                       stack_trace_window )


    # Watches
    vim.command( 'leftabove vertical new' )
    watch_window = vim.current.window

    # Variables
    vim.command( 'leftabove vertical new' )
    vars_window = vim.current.window


    with utils.LetCurrentWindow( vars_window ):
      vim.command( f'{ one_third }wincmd |' )
    with utils.LetCurrentWindow( watch_window ):
      vim.command( f'{ one_third }wincmd |' )
    with utils.LetCurrentWindow( stack_trace_window ):
      vim.command( f'{ one_third }wincmd |' )

    self._variablesView = variables.VariablesView( vars_window,
                                                   watch_window )


    # Output/logging
    vim.current.window = code_window
    vim.command( f'rightbelow { settings.Int( "bottombar_height" ) }new' )
    output_window = vim.current.window
    self._outputView = output.DAPOutputView( output_window,
                                             self._api_prefix )

    # TODO: If/when we support multiple sessions, we'll need some way to
    # indicate which tab was created and store all the tabs
    vim.vars[ 'vimspector_session_windows' ] = {
      'mode': 'vertical',
      'tabpage': self._uiTab.number,
      'code': utils.WindowID( code_window, self._uiTab ),
      'stack_trace': utils.WindowID( stack_trace_window, self._uiTab ),
      'variables': utils.WindowID( vars_window, self._uiTab ),
      'watches': utils.WindowID( watch_window, self._uiTab ),
      'output': utils.WindowID( output_window, self._uiTab ),
      'eval': None # this is going to be updated every time eval popup is opened
    }
    with utils.RestoreCursorPosition():
      with utils.RestoreCurrentWindow():
        with utils.RestoreCurrentBuffer( vim.current.window ):
          vim.command( 'doautocmd User VimspectorUICreated' )
Пример #3
0
    def _SetUpUI(self):
        original_window = vim.current.window

        vim.command('tabnew')
        self._uiTab = vim.current.tabpage

        # Code window
        self._codeView = code.CodeView(vim.current.window, original_window,
                                       self._api_prefix)

        # Call stack
        with utils.TemporaryVimOptions({
                'splitright': False,
                'equalalways': False,
        }):
            vim.command('topleft 50vspl')
            vim.command('enew')
            self._stackTraceView = stack_trace.StackTraceView(
                self, self._connection, vim.current.buffer)

        with utils.TemporaryVimOptions({
                'splitbelow': False,
                'eadirection': 'ver',
                'equalalways': True
        }):
            # Watches
            vim.command('spl')
            vim.command('enew')
            watch_win = vim.current.window

            # Variables
            vim.command('spl')
            vim.command('enew')
            vars_win = vim.current.window

            self._variablesView = variables.VariablesView(
                self._connection, vars_win, watch_win)

        with utils.TemporaryVimOption('splitbelow', True):
            vim.current.window = self._codeView._window

            # Output/logging
            vim.command('10spl')
            vim.command('enew')
            self._outputView = output.OutputView(self._connection,
                                                 vim.current.window,
                                                 self._api_prefix)