Example #1
0
    def _CreateBuffer(self,
                      category,
                      file_name=None,
                      cmd=None,
                      completion_handler=None,
                      syntax=None):

        buf_to_delete = None
        if (not self._buffers and self._window is not None
                and self._window.valid and not self._window.buffer.name):
            # If there's an empty buffer in the current window that we're not using,
            # delete it. We could try and use it, but that complicates the call to
            # SetUpCommandBuffer
            buf_to_delete = self._window.buffer

        if file_name is not None:
            assert cmd is None
            if install.GetOS() == "windows":
                # FIXME: Can't display fiels in windows (yet?)
                return

            cmd = ['tail', '-F', '-n', '+1', '--', file_name]

        if cmd is not None:
            out = utils.SetUpCommandBuffer(
                cmd,
                category,
                self._api_prefix,
                completion_handler=completion_handler)

            self._buffers[category] = TabBuffer(out, len(self._buffers))
            self._buffers[category].is_job = True
            self._RenderWinBar(category)
        else:
            if category == 'Console':
                name = 'vimspector.Console'
            else:
                name = 'vimspector.Output:{0}'.format(category)

            tab_buffer = TabBuffer(utils.NewEmptyBuffer(), len(self._buffers))

            self._buffers[category] = tab_buffer

            if category == 'Console':
                utils.SetUpPromptBuffer(tab_buffer.buf, name, '> ',
                                        'vimspector#EvaluateConsole',
                                        'vimspector#OmniFuncConsole')
            else:
                utils.SetUpHiddenBuffer(tab_buffer.buf, name)

            self._RenderWinBar(category)

        self._buffers[category].syntax = utils.SetSyntax(
            self._buffers[category].syntax, syntax,
            self._buffers[category].buf)

        if buf_to_delete:
            with utils.RestoreCurrentWindow():
                self._ShowOutput(category)
            utils.CleanUpHiddenBuffer(buf_to_delete)
Example #2
0
    def _DrawBalloonEval(self):
        watch = self._variable_eval
        view = self._variable_eval_view

        with utils.RestoreCursorPosition():
            with utils.ModifiableScratchBuffer(view.buf):
                utils.ClearBuffer(view.buf)
                view.syntax = utils.SetSyntax(view.syntax,
                                              self._current_syntax, view.buf)

                self._DrawWatchResult(view, 0, watch, is_short=True)

                vim.eval("vimspector#internal#balloon#ResizeTooltip()")
Example #3
0
  def _CreateBuffer( self,
                     category,
                     file_name = None,
                     cmd = None,
                     completion_handler = None,
                     syntax = None ):
    if file_name is not None:
      assert cmd is None
      if install.GetOS() == "windows":
        # FIXME: Can't display fiels in windows (yet?)
        return

      cmd = [ 'tail', '-F', '-n', '+1', '--', file_name ]

    if cmd is not None:
      out = utils.SetUpCommandBuffer(
        cmd,
        category,
        self._api_prefix,
        completion_handler = completion_handler )
      self._buffers[ category ] = TabBuffer( out, len( self._buffers ) )
      self._buffers[ category ].is_job = True
      self._RenderWinBar( category )
    else:
      if category == 'Console':
        name = 'vimspector.Console'
      else:
        name = 'vimspector.Output:{0}'.format( category )

      tab_buffer = TabBuffer( utils.NewEmptyBuffer(), len( self._buffers ) )
      self._buffers[ category ] = tab_buffer

      if category == 'Console':
        utils.SetUpPromptBuffer( tab_buffer.buf,
                                 name,
                                 '> ',
                                 'vimspector#EvaluateConsole' )
      else:
        utils.SetUpHiddenBuffer( tab_buffer.buf, name )

      self._RenderWinBar( category )

    self._buffers[ category ].syntax = utils.SetSyntax(
      self._buffers[ category ].syntax,
      syntax,
      self._buffers[ category ].buf )
Example #4
0
    def ShowMemory(self, memoryReference, length, offset, msg):
        if not self._window.valid:
            return False

        buf_name = os.path.join('_vimspector_mem', memoryReference)
        buf = utils.BufferForFile(buf_name)
        self._scratch_buffers.append(buf)
        utils.SetUpHiddenBuffer(buf, buf_name)
        with utils.ModifiableScratchBuffer(buf):
            # TODO: The data is encoded in base64, so we need to convert that to the
            # equivalent output of say xxd
            data = msg.get('body', {}).get('data', '')
            utils.SetBufferContents(buf, [
                f'Memory Dump for Reference {memoryReference} Length: {length} bytes'
                f' Offset: {offset}',
                '-' * 80,
                'Offset    Bytes                                             Text',
                '-' * 80,
            ])
            utils.AppendToBuffer(buf, utils.Base64ToHexDump(data))

        utils.SetSyntax('', 'vimspector-memory', buf)
        utils.JumpToWindow(self._window)
        utils.OpenFileInCurrentWindow(buf_name)
Example #5
0
 def SetSyntax(self, syntax):
     self._current_syntax = utils.SetSyntax(self._current_syntax, syntax,
                                            self._vars.win, self._watch.win)
Example #6
0
 def SetSyntax(self, syntax):
     self._current_syntax = utils.SetSyntax(self._current_syntax, syntax,
                                            self._win)
Example #7
0
 def SetSyntax(self, syntax):
     # TODO: Switch to View.syntax
     self._current_syntax = utils.SetSyntax(self._current_syntax, syntax,
                                            self._vars.buf, self._watch.buf)