def __init__( self, window ): self._window = window self._logger = logging.getLogger( __name__ ) utils.SetUpLogging( self._logger ) self._next_sign_id = 1 self._breakpoints = defaultdict( list ) self._signs = { 'vimspectorPC': None, 'breakpoints': [] } vim.current.window = self._window vim.command( 'nnoremenu WinBar.Continue :call vimspector#Continue()<CR>' ) vim.command( 'nnoremenu WinBar.Next :call vimspector#StepOver()<CR>' ) vim.command( 'nnoremenu WinBar.Step :call vimspector#StepInto()<CR>' ) vim.command( 'nnoremenu WinBar.Finish :call vimspector#StepOut()<CR>' ) vim.command( 'nnoremenu WinBar.Pause :call vimspector#Pause()<CR>' ) vim.command( 'nnoremenu WinBar.Stop :call vimspector#Stop()<CR>' ) vim.command( 'nnoremenu WinBar.Restart :call vimspector#Restart()<CR>' ) vim.command( 'nnoremenu WinBar.Reset :call vimspector#Reset()<CR>' ) vim.command( 'sign define vimspectorPC text=-> texthl=Search' )
def __init__(self): self._connection = None self._logger = logging.getLogger(__name__) utils.SetUpLogging(self._logger) # These are the user-entered breakpoints. self._line_breakpoints = defaultdict(list) self._func_breakpoints = [] self._exception_breakpoints = None self._configured_breakpoints = {} # FIXME: Remove this. Remove breakpoints nonesense from code.py self._breakpoints_handler = None self._server_capabilities = {} self._next_sign_id = 1 if not signs.SignDefined('vimspectorBP'): signs.DefineSign('vimspectorBP', text='●', double_text='●', texthl='WarningMsg') if not signs.SignDefined('vimspectorBPCond'): signs.DefineSign('vimspectorBPCond', text='◆', double_text='◆', texthl='WarningMsg') if not signs.SignDefined('vimspectorBPDisabled'): signs.DefineSign('vimspectorBPDisabled', text='●', double_text='●', texthl='LineNr')
def __init__(self, window, api_prefix): self._window = window self._api_prefix = api_prefix self._terminal_window = None self._terminal_buffer_number = None self.current_syntax = None self._logger = logging.getLogger(__name__) utils.SetUpLogging(self._logger) self._next_sign_id = 1 self._breakpoints = defaultdict(list) self._signs = {'vimspectorPC': None, 'breakpoints': []} with utils.LetCurrentWindow(self._window): vim.command( 'nnoremenu WinBar.Continue :call vimspector#Continue()<CR>') vim.command( 'nnoremenu WinBar.Next :call vimspector#StepOver()<CR>') vim.command( 'nnoremenu WinBar.Step :call vimspector#StepInto()<CR>') vim.command( 'nnoremenu WinBar.Finish :call vimspector#StepOut()<CR>') vim.command('nnoremenu WinBar.Pause :call vimspector#Pause()<CR>') vim.command('nnoremenu WinBar.Stop :call vimspector#Stop()<CR>') vim.command( 'nnoremenu WinBar.Restart :call vimspector#Restart()<CR>') vim.command('nnoremenu WinBar.Reset :call vimspector#Reset()<CR>') if not utils.SignDefined('vimspectorPC'): vim.command('sign define vimspectorPC text=-> texthl=Search')
def __init__(self, window, api_prefix): self._window = window self._api_prefix = api_prefix self._terminal_window = None self._terminal_buffer_number = None self.current_syntax = None self._logger = logging.getLogger(__name__) utils.SetUpLogging(self._logger) self._next_sign_id = 1 self._breakpoints = defaultdict(list) self._signs = {'vimspectorPC': None, 'breakpoints': []} with utils.LetCurrentWindow(self._window): vim.command( 'nnoremenu WinBar.■\\ Stop :call vimspector#Stop()<CR>') vim.command( 'nnoremenu WinBar.▶\\ Cont :call vimspector#Continue()<CR>') vim.command( 'nnoremenu WinBar.▷\\ Pause :call vimspector#Pause()<CR>') vim.command( 'nnoremenu WinBar.↷\\ Next :call vimspector#StepOver()<CR>') vim.command( 'nnoremenu WinBar.→\\ Step :call vimspector#StepInto()<CR>') vim.command( 'nnoremenu WinBar.←\\ Out :call vimspector#StepOut()<CR>') vim.command('nnoremenu WinBar.⟲: :call vimspector#Restart()<CR>') vim.command('nnoremenu WinBar.✕ :call vimspector#Reset()<CR>') if not utils.SignDefined('vimspectorPC'): utils.DefineSign('vimspectorPC', text='▶', texthl='MatchParen')
def __init__(self): self._logger = logging.getLogger(__name__) utils.SetUpLogging(self._logger) self._connection = None self._uiTab = None self._stackTraceView = None self._variablesView = None self._outputView = None self._next_sign_id = SIGN_ID_OFFSET # FIXME: This needs redesigning. There are a number of problems: # - breakpoints don't have to be line-wisw (e.g. method/exception) # - when the server moves/changes a breakpoint, this is not updated, # leading to them getting out of sync # - the split of responsibility between this object and the CodeView is # messy and ill-defined. self._line_breakpoints = defaultdict(list) self._func_breakpoints = [] self._configuration = None vim.command('sign define vimspectorBP text==> texthl=Error') vim.command('sign define vimspectorBPDisabled text=!> texthl=Warning')
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._current_thread = None self._current_frame = None self._current_syntax = "" self._threads = [] self._sources = {} utils.SetUpScratchBuffer(self._buf, 'vimspector.StackTrace') vim.current.buffer = self._buf # FIXME: Remove all usage of "Windown" and just use buffers to prevent all # the bugs around the window being closed. self._win = vim.current.window 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, api_prefix): self._logger = logging.getLogger(__name__) utils.SetUpLogging(self._logger) self._api_prefix = api_prefix self._logger.info("**** INITIALISING NEW VIMSPECTOR SESSION ****") self._logger.info("API is: {}".format(api_prefix)) self._logger.info('VIMSPECTOR_HOME = %s', VIMSPECTOR_HOME) self._logger.info('gadgetDir = %s', install.GetGadgetDir(VIMSPECTOR_HOME)) self._uiTab = None self._logView = None self._stackTraceView = None self._variablesView = None self._outputView = None self._breakpoints = breakpoints.ProjectBreakpoints() self._splash_screen = None self._remote_term = None self._run_on_server_exit = None self._configuration = None self._adapter = None self._ResetServerState()
def __init__(self, session, win): self._logger = logging.getLogger(__name__) utils.SetUpLogging(self._logger) self._buf = win.buffer self._session = session self._connection = None self._current_thread = None self._current_frame = None self._current_syntax = "" self._threads = [] self._sources = {} self._scratch_buffers = [] utils.SetUpHiddenBuffer(self._buf, 'vimspector.StackTrace') utils.SetUpUIWindow(win) 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 ): self._connection = None self._logger = logging.getLogger( __name__ ) utils.SetUpLogging( self._logger ) # These are the user-entered breakpoints. self._line_breakpoints = defaultdict( list ) self._func_breakpoints = [] self._exception_breakpoints = None self._configured_breakpoints = {} # FIXME: Remove this. Remove breakpoints nonesense from code.py self._breakpoints_handler = None self._server_capabilities = {} self._next_sign_id = 1 if not utils.SignDefined( 'vimspectorBP' ): vim.command( 'sign define vimspectorBP text==> texthl=Error' ) if not utils.SignDefined( 'vimspectorBPCond' ): vim.command( 'sign define vimspectorBPCond text=?> texthl=Error' ) if not utils.SignDefined( 'vimspectorBPDisabled' ): vim.command( 'sign define vimspectorBPDisabled text=!> texthl=Warning' )
def __init__(self, variables_win, watches_win): self._logger = logging.getLogger(__name__) utils.SetUpLogging(self._logger) self._connection = None self._current_syntax = '' # Set up the "Variables" buffer in the variables_win self._scopes: typing.List[Scope] = [] self._vars = View(variables_win, {}, self._DrawScopes) utils.SetUpHiddenBuffer(self._vars.buf, 'vimspector.Variables') with utils.LetCurrentWindow(variables_win): vim.command( 'nnoremap <buffer> <CR> :call vimspector#ExpandVariable()<CR>') # Set up the "Watches" buffer in the watches_win (and create a WinBar in # there) self._watches: typing.List[Watch] = [] self._watch = View(watches_win, {}, self._DrawWatches) utils.SetUpPromptBuffer(self._watch.buf, 'vimspector.Watches', 'Expression: ', 'vimspector#AddWatchPrompt', 'vimspector#OmniFuncWatch') with utils.LetCurrentWindow(watches_win): vim.command( 'nnoremap <buffer> <CR> :call vimspector#ExpandVariable()<CR>') vim.command( 'nnoremap <buffer> <DEL> :call vimspector#DeleteWatch()<CR>') vim.command('nnoremenu 1.1 WinBar.New ' ':call vimspector#AddWatch()<CR>') vim.command('nnoremenu 1.2 WinBar.Expand/Collapse ' ':call vimspector#ExpandVariable()<CR>') vim.command('nnoremenu 1.3 WinBar.Delete ' ':call vimspector#DeleteWatch()<CR>') # Set the (global!) balloon expr if supported 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 self._is_term = not bool(int(vim.eval("has( 'gui_running' )")))
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
def __init__( self, handlers, send_func ): self._logger = logging.getLogger( __name__ ) utils.SetUpLogging( self._logger ) self._Write = send_func self._SetState( 'READ_HEADER' ) self._buffer = bytes() self._handlers = handlers self._next_message_id = 0 self._outstanding_requests = {}
def __init__(self, window, api_prefix, render_event_emitter, IsBreakpointPresentAt): self._window = window self._api_prefix = api_prefix self._render_subject = render_event_emitter.subscribe(self._DisplayPC) self._IsBreakpointPresentAt = IsBreakpointPresentAt self._terminal = None self.current_syntax = None self._logger = logging.getLogger(__name__) utils.SetUpLogging(self._logger) # FIXME: This ID is by group, so should be module scope self._next_sign_id = 1 self._signs = { 'vimspectorPC': None, } self._current_frame = None self._scratch_buffers = [] with utils.LetCurrentWindow(self._window): if utils.UseWinBar(): # Buggy neovim doesn't render correctly when the WinBar is defined: # https://github.com/neovim/neovim/issues/12689 vim.command('nnoremenu WinBar.■\\ Stop ' ':call vimspector#Stop()<CR>') vim.command('nnoremenu WinBar.▶\\ Cont ' ':call vimspector#Continue()<CR>') vim.command('nnoremenu WinBar.▷\\ Pause ' ':call vimspector#Pause()<CR>') vim.command('nnoremenu WinBar.↷\\ Next ' ':call vimspector#StepOver()<CR>') vim.command('nnoremenu WinBar.→\\ Step ' ':call vimspector#StepInto()<CR>') vim.command('nnoremenu WinBar.←\\ Out ' ':call vimspector#StepOut()<CR>') vim.command('nnoremenu WinBar.⟲: ' ':call vimspector#Restart()<CR>') vim.command('nnoremenu WinBar.✕ ' ':call vimspector#Reset()<CR>') if not signs.SignDefined('vimspectorPC'): signs.DefineSign('vimspectorPC', text='▶', double_text='▶', texthl='MatchParen', linehl='CursorLine') if not signs.SignDefined('vimspectorPCBP'): signs.DefineSign('vimspectorPCBP', text='●▶', double_text='▷', texthl='MatchParen', linehl='CursorLine')
def __init__(self, session, win): self._logger = logging.getLogger(__name__) utils.SetUpLogging(self._logger) self._buf = win.buffer self._session = session self._connection = None self._current_thread = None self._current_frame = None self._current_syntax = "" self._threads = [] self._sources = {} self._scratch_buffers = [] # FIXME: This ID is by group, so should be module scope self._next_sign_id = 1 utils.SetUpHiddenBuffer(self._buf, 'vimspector.StackTrace') utils.SetUpUIWindow(win) mappings = settings.Dict('mappings')['stack_trace'] with utils.LetCurrentWindow(win): for mapping in utils.GetVimList(mappings, 'expand_or_jump'): vim.command(f'nnoremap <silent> <buffer> { mapping } ' ':<C-U>call vimspector#GoToFrame()<CR>') for mapping in utils.GetVimList(mappings, 'focus_thread'): vim.command(f'nnoremap <silent> <buffer> { mapping } ' ':<C-U>call vimspector#SetCurrentThread()<CR>') if utils.UseWinBar(): vim.command('nnoremenu <silent> 1.1 WinBar.Pause/Continue ' ':call vimspector#PauseContinueThread()<CR>') vim.command('nnoremenu <silent> 1.2 WinBar.Expand/Collapse ' ':call vimspector#GoToFrame()<CR>') vim.command('nnoremenu <silent> 1.3 WinBar.Focus ' ':call vimspector#SetCurrentThread()<CR>') win.options['cursorline'] = False if not signs.SignDefined('vimspectorCurrentThread'): signs.DefineSign('vimspectorCurrentThread', text='▶ ', double_text='▶', texthl='MatchParen', linehl='CursorLine') self._line_to_frame = {} self._line_to_thread = {} self._requesting_threads = StackTraceView.ThreadRequestState.NO self._pending_thread_request = None
def __init__( self, render_event_emitter, IsPCPresentAt ): self._connection = None self._logger = logging.getLogger( __name__ ) self._render_subject = render_event_emitter.subscribe( self.Refresh ) self._IsPCPresentAt = IsPCPresentAt utils.SetUpLogging( self._logger ) # These are the user-entered breakpoints. self._line_breakpoints = defaultdict( list ) self._func_breakpoints = [] self._exception_breakpoints = None self._configured_breakpoints = {} self._server_capabilities = {} self._next_sign_id = 1 self._awaiting_bp_responses = 0 self._pending_send_breakpoints = None self._breakpoints_view = BreakpointsView() if not signs.SignDefined( 'vimspectorBP' ): signs.DefineSign( 'vimspectorBP', text = '●', double_text = '●', texthl = 'WarningMsg' ) if not signs.SignDefined( 'vimspectorBPCond' ): signs.DefineSign( 'vimspectorBPCond', text = '◆', double_text = '◆', texthl = 'WarningMsg' ) if not signs.SignDefined( 'vimspectorBPLog' ): signs.DefineSign( 'vimspectorBPLog', text = '◆', double_text = '◆', texthl = 'SpellRare' ) if not signs.SignDefined( 'vimspectorBPDisabled' ): signs.DefineSign( 'vimspectorBPDisabled', text = '●', double_text = '●', texthl = 'LineNr' )
def __init__(self): self._logger = logging.getLogger(__name__) utils.SetUpLogging(self._logger) self._logger.info('VIMSPECTOR_HOME = %s', VIMSPECTOR_HOME) self._logger.info( 'gadgetDir = %s', install.GetGadgetDir(VIMSPECTOR_HOME, install.GetOS())) self._uiTab = None self._stackTraceView = None self._variablesView = None self._outputView = None self._breakpoints = breakpoints.ProjectBreakpoints() self._run_on_server_exit = None self._ResetServerState()
def __init__(self, handlers, send_func, sync_timeout=None, async_timeout=None): self._logger = logging.getLogger(__name__) utils.SetUpLogging(self._logger) if not sync_timeout: sync_timeout = DEFAULT_SYNC_TIMEOUT if not async_timeout: async_timeout = DEFAULT_ASYNC_TIMEOUT self._Write = send_func self._SetState('READ_HEADER') self._buffer = bytes() self._handlers = handlers self._next_message_id = 0 self._outstanding_requests = {} self.async_timeout = async_timeout self.sync_timeout = sync_timeout
def __init__(self, variables_win, watches_win): self._logger = logging.getLogger(__name__) utils.SetUpLogging(self._logger) self._connection = None self._current_syntax = '' self._server_capabilities = None self._variable_eval: Scope = None self._variable_eval_view: View = None mappings = settings.Dict('mappings')['variables'] # Set up the "Variables" buffer in the variables_win self._scopes: typing.List[Scope] = [] self._vars = View(variables_win, {}, self._DrawScopes) utils.SetUpHiddenBuffer(self._vars.buf, 'vimspector.Variables') with utils.LetCurrentWindow(variables_win): if utils.UseWinBar(): vim.command('nnoremenu <silent> 1.1 WinBar.Set ' ':call vimspector#SetVariableValue()<CR>') AddExpandMappings(mappings) # Set up the "Watches" buffer in the watches_win (and create a WinBar in # there) self._watches: typing.List[Watch] = [] self._watch = View(watches_win, {}, self._DrawWatches) utils.SetUpPromptBuffer(self._watch.buf, 'vimspector.Watches', 'Expression: ', 'vimspector#AddWatchPrompt', 'vimspector#OmniFuncWatch') with utils.LetCurrentWindow(watches_win): AddExpandMappings(mappings) for mapping in utils.GetVimList(mappings, 'delete'): vim.command( f'nnoremap <buffer> { mapping } :call vimspector#DeleteWatch()<CR>' ) if utils.UseWinBar(): vim.command('nnoremenu <silent> 1.1 WinBar.New ' ':call vimspector#AddWatch()<CR>') vim.command('nnoremenu <silent> 1.2 WinBar.Expand/Collapse ' ':call vimspector#ExpandVariable()<CR>') vim.command('nnoremenu <silent> 1.3 WinBar.Delete ' ':call vimspector#DeleteWatch()<CR>') vim.command('nnoremenu <silent> 1.1 WinBar.Set ' ':call vimspector#SetVariableValue()<CR>') # Set the (global!) balloon expr if supported 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#HoverTooltip()") 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 self._is_term = not bool(int(vim.eval("has( 'gui_running' )")))