def _RenderWinBar(self, category): if not utils.UseWinBar(): return if not self._window.valid: return with utils.LetCurrentWindow(self._window): tab_buffer = self._buffers[category] try: if tab_buffer.flag: vim.command('nunmenu WinBar.{}'.format( utils.Escape(category))) else: vim.command('nunmenu WinBar.{}*'.format( utils.Escape(category))) except vim.error as e: # E329 means the menu doesn't exist; ignore that. if 'E329' not in str(e): raise vim.command( "nnoremenu <silent> 1.{0} WinBar.{1}{2} " ":call vimspector#ShowOutputInWindow( {3}, '{1}' )<CR>".format( tab_buffer.index, utils.Escape(category), '*' if tab_buffer.flag else '', utils.WindowID(self._window)))
def SetSyntax(self, syntax): if not syntax: syntax = '' if self._current_syntax == syntax: return self._current_syntax = syntax with utils.LetCurrentWindow(self._vars.win): vim.command('set syntax={}'.format(utils.Escape(syntax))) with utils.LetCurrentWindow(self._watch.win): vim.command('set syntax={}'.format(utils.Escape(syntax)))
def _RenderWinBar(self, category): tab_buffer = self._buffers[category] try: if tab_buffer.flag: vim.command('nunmenu WinBar.{}'.format(utils.Escape(category))) else: vim.command('nunmenu WinBar.{}*'.format( utils.Escape(category))) except vim.error as e: # E329 means the menu doesn't exist; ignore that. if 'E329' not in str(e): raise vim.command("nnoremenu 1.{0} WinBar.{1}{2} " ":call vimspector#ShowOutput( '{1}' )<CR>".format( tab_buffer.index, utils.Escape(category), '*' if tab_buffer.flag else ''))
def _RenderWinBar(self, category): if not self._window.valid: return with utils.LetCurrentWindow(self._window): tab_buffer = self._buffers[category] try: if tab_buffer.flag: vim.command('nunmenu WinBar.{}'.format( utils.Escape(category))) else: vim.command('nunmenu WinBar.{}*'.format( utils.Escape(category))) except vim.error as e: # E329 means the menu doesn't exist; ignore that. if 'E329' not in str(e): raise
def _SignToLine( self, file_name, bp ): if 'sign_id' not in bp: return bp[ 'line' ] signs = vim.eval( "sign_getplaced( '{}', {} )".format( utils.Escape( file_name ), json.dumps( { 'id': file_name, 'group': 'VimspectorBP', } ) ) ) if len( signs ) == 1 and len( signs[ 0 ][ 'signs' ] ) == 1: bp[ 'line' ] = int( signs[ 0 ][ 'signs' ][ 0 ][ 'lnum' ] ) return bp[ 'line' ]
def _SignToLine( self, file_name, bp ): if self._connection is not None: return if 'sign_id' not in bp: return bp[ 'line' ] if not utils.BufferExists( file_name ): return bp[ 'line' ] signs = vim.eval( "sign_getplaced( '{}', {} )".format( utils.Escape( file_name ), json.dumps( { 'id': bp[ 'sign_id' ], 'group': 'VimspectorBP', } ) ) ) if len( signs ) == 1 and len( signs[ 0 ][ 'signs' ] ) == 1: bp[ 'line' ] = int( signs[ 0 ][ 'signs' ][ 0 ][ 'lnum' ] ) return bp[ 'line' ]
def _CreateBuffer(self, category): with utils.RestoreCurrentWindow(): vim.current.window = self._window with utils.RestoreCurrentBuffer(self._window): vim.command('enew') self._buffers[category] = vim.current.buffer if category == 'Console': utils.SetUpPromptBuffer(self._buffers[category], 'vimspector.Console', '> ', 'vimspector#EvaluateConsole', hidden=True) else: utils.SetUpHiddenBuffer( self._buffers[category], 'vimspector.Output:{0}'.format(category)) vim.command("nnoremenu WinBar.{0} " ":call vimspector#ShowOutput( '{0}' )<CR>".format( utils.Escape(category)))