Exemple #1
0
  def __init__( self, session, connection, buf ):
    self._logger = logging.getLogger( __name__ )
    utils.SetUpLogging( self._logger )

    self._buf = buf
    self._session = session
    self._connection = connection

    self._currentThread = None
    self._currentFrame = None

    self._threads = []
    self._sources = {}

    utils.SetUpScratchBuffer( self._buf, 'vimspector.StackTrace' )
    vim.current.buffer = self._buf
    vim.command( 'nnoremap <buffer> <CR> :call vimspector#GoToFrame()<CR>' )

    self._line_to_frame = {}
    self._line_to_thread = {}

    # TODO: We really need a proper state model
    #
    # AWAIT_CONNECTION -- OnServerReady / RequestThreads --> REQUESTING_THREADS
    # REQUESTING -- OnGotThreads / RequestScopes --> REQUESTING_SCOPES
    #
    # When we attach using gdbserver, this whole thing breaks because we request
    # the threads over and over and get duff data back on later threads.
    self._requesting_threads = False
  def __init__( self, connection, variables_win, watches_win ):
    self._logger = logging.getLogger( __name__ )
    utils.SetUpLogging( self._logger )

    self._vars = View( variables_win, {}, self._DrawScopes )
    self._watch = View( watches_win, {}, self._DrawWatches )
    self._connection = connection

    # Allows us to hit <CR> to expand/collapse variables
    vim.current.window = self._vars.win
    vim.command(
      'nnoremap <buffer> <CR> :call vimspector#ExpandVariable()<CR>' )

    # This is actually the tree (scopes are alwyas the root)
    #  it's just a list of DAP scope dicts, with one magic key (_variables)
    #  _variables is a list of DAP variable with the same magic key
    #
    # If _variables is present, then we have requested and should display the
    # children. Otherwise, we haven't or shouldn't.
    self._scopes = []

    # This is similar to scopes, but the top level is an "expression" (request)
    # containing a special '_result' key which is the response. The response
    # structure con contain _variables and is handled identically to the scopes
    # above. It also has a special _line key which is where we printed it (last)
    self._watches = []

    # Allows us to hit <CR> to expand/collapse variables
    vim.current.window = self._watch.win
    vim.command(
      'nnoremap <buffer> <CR> :call vimspector#ExpandVariable()<CR>' )
    vim.command(
      'nnoremap <buffer> <DEL> :call vimspector#DeleteWatch()<CR>' )

    utils.SetUpScratchBuffer( self._vars.win.buffer, 'vimspector.Variables' )
    utils.SetUpPromptBuffer( self._watch.win.buffer,
                             'vimspector.Watches',
                             'Expression: ',
                             'vimspector#AddWatchPrompt' )

    has_balloon      = int( vim.eval( "has( 'balloon_eval' )" ) )
    has_balloon_term = int( vim.eval( "has( 'balloon_eval_term' )" ) )

    self._oldoptions = {}
    if has_balloon or has_balloon_term:
      self._oldoptions = {
        'balloonexpr': vim.options[ 'balloonexpr' ],
        'balloondelay': vim.options[ 'balloondelay' ],
      }
      vim.options[ 'balloonexpr' ] = 'vimspector#internal#balloon#BalloonExpr()'
      vim.options[ 'balloondelay' ] = 250

    if has_balloon:
      self._oldoptions[ 'ballooneval' ] = vim.options[ 'ballooneval' ]
      vim.options[ 'ballooneval' ] = True

    if has_balloon_term:
      self._oldoptions[ 'balloonevalterm' ] = vim.options[ 'balloonevalterm' ]
      vim.options[ 'balloonevalterm' ] = True
Exemple #3
0
      def consume_source( msg ):
        self._sources[ source_reference ] = source

        buf_name = os.path.join( '_vimspector_tmp', source[ 'name' ] )

        self._logger.debug( "Received source %s: %s", buf_name, msg )

        buf = utils.BufferForFile( buf_name )
        utils.SetUpScratchBuffer( buf, buf_name )
        source[ 'path' ] = buf_name
        with utils.ModifiableScratchBuffer( buf ):
          utils.SetBufferContents( buf, msg[ 'body' ][ 'content' ] )

        and_then( self._sources[ source_reference ] )
Exemple #4
0
    def __init__(self, session, connection, buf):
        self._buf = buf
        self._session = session
        self._connection = connection

        self._currentThread = None
        self._currentFrame = None

        self._threads = []

        utils.SetUpScratchBuffer(self._buf, 'vimspector.StackTrace')
        vim.current.buffer = self._buf
        vim.command('nnoremap <buffer> <CR> :call vimspector#GoToFrame()<CR>')

        self._line_to_frame = {}
        self._line_to_thread = {}