Switch to running the actual install_gadget.py

This re-uses the OutputView code to run the installer script. Refactor
to remove connection from the base OutputView (and other places, it
wasn't used - only used after ConnectionUp).

This also consolidates the stdout and stderr buffers for running jobs.
The distinction was always arbitrary and probably an error, based on the
fact that they were separate in the APIs not based on usability.
This commit is contained in:
Ben Jackson 2020-07-21 16:43:39 +01:00
commit 23e5f6bbf4
12 changed files with 236 additions and 167 deletions

View file

@ -132,6 +132,14 @@ function! vimspector#ShowOutput( category ) abort
py3 _vimspector_session.ShowOutput( vim.eval( 'a:category' ) ) py3 _vimspector_session.ShowOutput( vim.eval( 'a:category' ) )
endfunction endfunction
function! vimspector#ShowOutputInWindow( win_id, category ) abort
py3 <<EOF
from vimspector import output as vimspector_output
vimspector_output.ShowOutputInWindow( int( vim.eval( 'a:win_id' ) ),
vim.eval( 'a:category' ) )
EOF
endfunction
function! vimspector#ListBreakpoints() abort function! vimspector#ListBreakpoints() abort
py3 _vimspector_session.ListBreakpoints() py3 _vimspector_session.ListBreakpoints()
endfunction endfunction
@ -154,48 +162,13 @@ function! vimspector#Install( ... ) abort
if a:0 < 1 if a:0 < 1
return return
endif endif
let prefix = vimspector#internal#state#GetAPIPrefix()
let gadgets = a:000
let force = a:1 ==# '--force'
if force
let gadgets = a:000[ 1: ]
endif
py3 << EOF py3 << EOF
from vimspector import installer as vimspector_installer from vimspector import installer as vimspector_installer
from vimspector import utils as vimspector_utils vimspector_installer.RunInstaller( vim.eval( 'prefix' ), *vim.eval( 'a:000' ) )
vimspector_installer.Configure(
vimspector_base = vimspector_utils.GetVimspectorBase() )
vimspector_installer.Install( vim.eval( 'gadgets'), vim.eval( 'force' ) )
EOF EOF
endfunction endfunction
function! vimspector#CompleteInstall( ArgLead, CmdLine, CursorPos ) abort
let words = split( a:CmdLine )
let done_options = v:false
for word in words
if ! word =~# '^--'
let done_options = v:true
break
endif
endfor
let options = []
if !done_options
call extend( options, [ '--force' ] )
endif
py3 from vimspector import installer as vimspector_installer
call extend( options, [ 'all' ] )
call extend(
\ options,
\ py3eval(
\ '[ g[ "language" ] for g in vimspector_installer.GADGETS.values() ]' ) )
return join( options, "\n" )
endfunction
" Boilerplate {{{ " Boilerplate {{{
let &cpoptions=s:save_cpo let &cpoptions=s:save_cpo
unlet s:save_cpo unlet s:save_cpo

View file

@ -157,14 +157,16 @@ function! vimspector#internal#job#StartCommandWithLog( cmd, category ) abort
let l:index = len( s:commands[ a:category ] ) let l:index = len( s:commands[ a:category ] )
let buf = '_vimspector_log_' . a:category
call add( s:commands[ a:category ], job_start( call add( s:commands[ a:category ], job_start(
\ a:cmd, \ a:cmd,
\ { \ {
\ 'out_io': 'buffer', \ 'out_io': 'buffer',
\ 'in_io': 'null', \ 'in_io': 'null',
\ 'err_io': 'buffer', \ 'err_io': 'buffer',
\ 'out_name': '_vimspector_log_' . a:category . '_out', \ 'out_name': buf,
\ 'err_name': '_vimspector_log_' . a:category . '_err', \ 'err_name': buf,
\ 'out_modifiable': 0, \ 'out_modifiable': 0,
\ 'err_modifiable': 0, \ 'err_modifiable': 0,
\ 'stoponexit': 'kill' \ 'stoponexit': 'kill'
@ -176,12 +178,7 @@ function! vimspector#internal#job#StartCommandWithLog( cmd, category ) abort
return v:none return v:none
endif endif
let l:stdout = ch_getbufnr( return bufnr( buf )
\ job_getchannel( s:commands[ a:category ][ index ] ), 'out' )
let l:stderr = ch_getbufnr(
\ job_getchannel( s:commands[ a:category ][ index ] ), 'err' )
return [ l:stdout, l:stderr ]
endfunction endfunction

View file

@ -198,14 +198,12 @@ function! vimspector#internal#neojob#StartCommandWithLog( cmd, category ) abort
let s:commands[ a:category ] = {} let s:commands[ a:category ] = {}
endif endif
let stdout_buf = bufnr( '_vimspector_log_' . a:category . '_out', v:true ) let buf = bufnr( '_vimspector_log_' . a:category, v:true )
let stderr_buf = bufnr( '_vimspector_log_' . a:category . '_err', v:true )
" FIXME: This largely duplicates the same stuff in the python layer, but we " FIXME: This largely duplicates the same stuff in the python layer, but we
" don't want to potentially mess up Vim behaviour where the job output is " don't want to potentially mess up Vim behaviour where the job output is
" attached to a buffer set up by Vim. So we sort o mimic that here. " attached to a buffer set up by Vim. So we sort o mimic that here.
call s:SetUpHiddenBuffer( stdout_buf ) call s:SetUpHiddenBuffer( buf )
call s:SetUpHiddenBuffer( stderr_buf )
let id = jobstart(a:cmd, let id = jobstart(a:cmd,
\ { \ {
@ -216,11 +214,11 @@ function! vimspector#internal#neojob#StartCommandWithLog( cmd, category ) abort
\ } ) \ } )
let s:commands[ a:category ][ id ] = { let s:commands[ a:category ][ id ] = {
\ 'stdout': stdout_buf, \ 'stdout': buf,
\ 'stderr': stderr_buf \ 'stderr': buf
\ } \ }
return [ stdout_buf, stderr_buf ] return buf
endfunction endfunction
function! vimspector#internal#neojob#CleanUpCommand( category ) abort function! vimspector#internal#neojob#CleanUpCommand( category ) abort

View file

@ -19,20 +19,23 @@ let s:save_cpo = &cpoptions
set cpoptions&vim set cpoptions&vim
" }}} " }}}
let s:is_neovim = has( 'nvim' ) let s:prefix = ''
if has( 'nvim' )
let s:prefix='neo'
endif
function! vimspector#internal#state#Reset() abort function! vimspector#internal#state#Reset() abort
let prefix = ''
if s:is_neovim
let prefix='neo'
endif
py3 << EOF py3 << EOF
import vim import vim
from vimspector import debug_session from vimspector import debug_session
_vimspector_session = debug_session.DebugSession( vim.eval( 'prefix' ) ) _vimspector_session = debug_session.DebugSession( vim.eval( 's:prefix' ) )
EOF EOF
endfunction endfunction
function! vimspector#internal#state#GetAPIPrefix() abort
return s:prefix
endfunction
" Boilerplate {{{ " Boilerplate {{{
let &cpoptions=s:save_cpo let &cpoptions=s:save_cpo
unlet s:save_cpo unlet s:save_cpo

View file

@ -163,6 +163,7 @@ for custom_file_name in functools.reduce( operator.add,
failed = [] failed = []
succeeded = []
all_adapters = installer.ReadAdapters( all_adapters = installer.ReadAdapters(
read_existing = args.update_gadget_config ) read_existing = args.update_gadget_config )
@ -179,12 +180,13 @@ for name, gadget in gadgets.GADGETS.items():
installer.InstallGagdet( name, installer.InstallGagdet( name,
gadget, gadget,
succeeded,
failed, failed,
all_adapters ) all_adapters )
for name, gadget in CUSTOM_GADGETS.items(): for name, gadget in CUSTOM_GADGETS.items():
installer.InstallGagdet( name, gadget, failed, all_adapters ) installer.InstallGagdet( name, gadget, succeeded, failed, all_adapters )
if args.no_gadget_config: if args.no_gadget_config:
print( "" ) print( "" )
@ -193,12 +195,15 @@ if args.no_gadget_config:
else: else:
installer.WriteAdapters( all_adapters ) installer.WriteAdapters( all_adapters )
if failed:
raise RuntimeError( 'Failed to install gadgets: {}'.format(
','.join( failed ) ) )
if args.basedir: if args.basedir:
print( "" ) print( "" )
print( "***NOTE***: You set --basedir to " + args.basedir + print( "***NOTE***: You set --basedir to " + args.basedir +
". Therefore you _must_ ensure this is in your vimrc:\n" ". Therefore you _must_ ensure this is in your vimrc:\n"
"let g:vimspector_base_dir='" + vimspector_base + "'" ) "let g:vimspector_base_dir='" + vimspector_base + "'" )
if succeeded:
print( "The following adapters were installed successfully: {}".format(
','.join( succeeded ) ) )
if failed:
sys.exit( 'Failed to install adapters: {}'.format( ','.join( failed ) ) )

View file

@ -34,6 +34,7 @@ endif
" - Add commands/mappings/menus? " - Add commands/mappings/menus?
let g:loaded_vimpector = 1 let g:loaded_vimpector = 1
let g:vimspector_home = expand( '<sfile>:p:h:h' )
let s:mappings = get( g:, 'vimspector_enable_mappings', '' ) let s:mappings = get( g:, 'vimspector_enable_mappings', '' )
@ -98,7 +99,7 @@ command! -bar
\ call vimspector#Reset() \ call vimspector#Reset()
" Installer commands " Installer commands
command! -bar -nargs=* -complete=custom,vimspector#CompleteInstall command! -bar -nargs=*
\ VimspectorInstall \ VimspectorInstall
\ call vimspector#Install( <f-args> ) \ call vimspector#Install( <f-args> )

View file

@ -528,7 +528,6 @@ class DebugSession( object ):
stack_trace_window = vim.current.window stack_trace_window = vim.current.window
one_third = int( vim.eval( 'winheight( 0 )' ) ) / 3 one_third = int( vim.eval( 'winheight( 0 )' ) ) / 3
self._stackTraceView = stack_trace.StackTraceView( self, self._stackTraceView = stack_trace.StackTraceView( self,
self._connection,
stack_trace_window ) stack_trace_window )
# Watches # Watches
@ -546,17 +545,15 @@ class DebugSession( object ):
with utils.LetCurrentWindow( stack_trace_window ): with utils.LetCurrentWindow( stack_trace_window ):
vim.command( f'{ one_third }wincmd _' ) vim.command( f'{ one_third }wincmd _' )
self._variablesView = variables.VariablesView( self._connection, self._variablesView = variables.VariablesView( vars_window,
vars_window,
watch_window ) watch_window )
# Output/logging # Output/logging
vim.current.window = code_window vim.current.window = code_window
vim.command( f'rightbelow { settings.Int( "bottombar_height", 10 ) }new' ) vim.command( f'rightbelow { settings.Int( "bottombar_height", 10 ) }new' )
output_window = vim.current.window output_window = vim.current.window
self._outputView = output.OutputView( self._connection, self._outputView = output.DAPOutputView( output_window,
output_window, self._api_prefix )
self._api_prefix )
# TODO: If/when we support multiple sessions, we'll need some way to # TODO: If/when we support multiple sessions, we'll need some way to
# indicate which tab was created and store all the tabs # indicate which tab was created and store all the tabs

View file

@ -36,7 +36,9 @@ import traceback
import zipfile import zipfile
import json import json
from vimspector import install, gadgets from vimspector import install
OUTPUT_VIEW = None
class Options: class Options:
@ -52,31 +54,94 @@ def Configure( **kwargs ):
setattr( options, k, v ) setattr( options, k, v )
def Install( languages, force ): def PathToAnyWorkingPython3():
all_enabled = 'all' in languages # We can't rely on sys.executable because it's usually 'vim' (fixme, not with
force_all = all_enabled and force # neovim?)
paths = os.environ[ 'PATH' ].split( os.pathsep )
install.MakeInstallDirs( options.vimspector_base ) if install.GetOS() == 'windows':
all_adapters = ReadAdapters() paths.insert( 0, os.getcwd() )
failed = [] candidates = [ os.path.join( sys.exec_prefix, 'python.exe' ),
'python.exe' ]
else:
candidates = [ os.path.join( sys.exec_prefix, 'bin', 'python3' ),
'python3',
'python' ]
for name, gadget in gadgets.GADGETS.items(): for candidate in candidates:
if not gadget.get( 'enabled', True ): for path in paths:
if ( not force_all filename = os.path.abspath( os.path.join( path, candidate ) )
and not ( force and gadget[ 'language' ] in languages ) ): if not os.path.isfile( filename ):
continue continue
else: if not os.access( filename, os.F_OK | os.X_OK ):
if not all_enabled and not gadget[ 'language' ] in languages:
continue continue
InstallGagdet( name, return filename
gadget,
failed,
all_adapters )
WriteAdapters( all_adapters ) raise RuntimeError( "Unable to find a working python3" )
def RunInstaller( api_prefix, *args ):
from vimspector import utils, output, settings
import vim
vimspector_home = utils.GetVimString( vim.vars, 'vimspector_home' )
vimspector_base_dir = utils.GetVimspectorBase()
# TODO: Translate the arguments to something more user-friendly than -- args
global OUTPUT_VIEW
if OUTPUT_VIEW:
OUTPUT_VIEW.Reset()
OUTPUT_VIEW = None
with utils.RestoreCurrentWindow():
vim.command( f'botright { settings.Int( "bottombar_height", 10 ) }new' )
win = vim.current.window
OUTPUT_VIEW = output.OutputView( win, api_prefix )
cmd = [
PathToAnyWorkingPython3(),
'-u',
os.path.join( vimspector_home, 'install_gadget.py' ),
'--update-gadget-config',
]
if not vimspector_base_dir == vimspector_home:
cmd.extend( '--basedir', vimspector_base_dir )
cmd.extend( args )
OUTPUT_VIEW.RunJobWithOutput( 'Installer', cmd )
OUTPUT_VIEW.ShowOutput( 'Installer' )
# def Install( languages, force ):
# all_enabled = 'all' in languages
# force_all = all_enabled and force
#
# install.MakeInstallDirs( options.vimspector_base )
# all_adapters = ReadAdapters()
# succeeded = []
# failed = []
#
# for name, gadget in gadgets.GADGETS.items():
# if not gadget.get( 'enabled', True ):
# if ( not force_all
# and not ( force and gadget[ 'language' ] in languages ) ):
# continue
# else:
# if not all_enabled and not gadget[ 'language' ] in languages:
# continue
#
# InstallGagdet( name,
# gadget,
# succeeded,
# failed,
# all_adapters )
#
# WriteAdapters( all_adapters )
#
# return succeeded, failed
return failed
def InstallGeneric( name, root, gadget ): def InstallGeneric( name, root, gadget ):
@ -182,7 +247,7 @@ def InstallNodeDebug( name, root, gadget ):
MakeSymlink( name, root ) MakeSymlink( name, root )
def InstallGagdet( name, gadget, failed, all_adapters ): def InstallGagdet( name, gadget, succeeded, failed, all_adapters ):
try: try:
v = {} v = {}
v.update( gadget.get( 'all', {} ) ) v.update( gadget.get( 'all', {} ) )
@ -235,6 +300,7 @@ def InstallGagdet( name, gadget, failed, all_adapters ):
# Add any other "all" adapters # Add any other "all" adapters
all_adapters.update( gadget.get( 'adapters', {} ) ) all_adapters.update( gadget.get( 'adapters', {} ) )
succeeded.append( name )
print( "Done installing {}".format( name ) ) print( "Done installing {}".format( name ) )
except Exception as e: except Exception as e:
traceback.print_exc() traceback.print_exc()

View file

@ -25,7 +25,6 @@ class TabBuffer( object ):
self.index = index self.index = index
self.flag = False self.flag = False
self.is_job = False self.is_job = False
self.job_category = None
BUFFER_MAP = { BUFFER_MAP = {
@ -40,18 +39,24 @@ def CategoryToBuffer( category ):
return BUFFER_MAP.get( category, category ) return BUFFER_MAP.get( category, category )
VIEWS = set()
def ShowOutputInWindow( win_id, category ):
for view in VIEWS:
if view._window.valid and utils.WindowID( view._window ) == win_id:
view.ShowOutput( category )
return
raise ValueError( f'Unable to find output object for win id {win_id}!' )
class OutputView( object ): class OutputView( object ):
def __init__( self, connection, window, api_prefix ): def __init__( self, window, api_prefix ):
self._window = window self._window = window
self._connection = connection
self._buffers = {} self._buffers = {}
self._api_prefix = api_prefix self._api_prefix = api_prefix
VIEWS.add( self )
for b in set( BUFFER_MAP.values() ):
self._CreateBuffer( b )
self._CreateBuffer( 'Vimspector', file_name = utils.LOG_FILE )
self._ShowOutput( 'Console' )
def Print( self, categroy, text ): def Print( self, categroy, text ):
self._Print( 'server', text.splitlines() ) self._Print( 'server', text.splitlines() )
@ -82,22 +87,23 @@ class OutputView( object ):
with utils.RestoreCurrentBuffer( self._window ): with utils.RestoreCurrentBuffer( self._window ):
self._ShowOutput( category ) self._ShowOutput( category )
def ConnectionUp( self, connection ):
self._connection = connection
def ConnectionClosed( self ):
# Don't clear because output is probably still useful
self._connection = None
def Reset( self ): def Reset( self ):
self.Clear() self.Clear()
VIEWS.remove( self )
def _CleanUpBuffer( self, category, tab_buffer = None ):
if tab_buffer is None:
tab_buffer = self._buffers[ category ]
if tab_buffer.is_job:
utils.CleanUpCommand( category, self._api_prefix )
utils.CleanUpHiddenBuffer( tab_buffer.buf )
def Clear( self ): def Clear( self ):
for category, tab_buffer in self._buffers.items(): for category, tab_buffer in self._buffers.items():
if tab_buffer.is_job: self._CleanUpBuffer( category, tab_buffer )
utils.CleanUpCommand( tab_buffer.job_category or category,
self._api_prefix )
utils.CleanUpHiddenBuffer( tab_buffer.buf )
# FIXME: nunmenu the WinBar ? # FIXME: nunmenu the WinBar ?
self._buffers = {} self._buffers = {}
@ -125,28 +131,6 @@ class OutputView( object ):
self._ToggleFlag( category, False ) self._ToggleFlag( category, False )
self._ShowOutput( category ) self._ShowOutput( category )
def Evaluate( self, frame, expression ):
self._Print( 'Console', [ 'Evaluating: ' + expression ] )
def print_result( message ):
result = message[ 'body' ][ 'result' ]
if result is None:
result = '<no result>'
self._Print( 'Console', f' Result: { result }' )
request = {
'command': 'evaluate',
'arguments': {
'expression': expression,
'context': 'repl',
}
}
if frame:
request[ 'arguments' ][ 'frameId' ] = frame[ 'id' ]
self._connection.DoRequest( print_result, request )
def _ToggleFlag( self, category, flag ): def _ToggleFlag( self, category, flag ):
if self._buffers[ category ].flag != flag: if self._buffers[ category ].flag != flag:
self._buffers[ category ].flag = flag self._buffers[ category ].flag = flag
@ -178,16 +162,10 @@ class OutputView( object ):
cmd = [ 'tail', '-F', '-n', '+1', '--', file_name ] cmd = [ 'tail', '-F', '-n', '+1', '--', file_name ]
if cmd is not None: if cmd is not None:
out, err = utils.SetUpCommandBuffer( cmd, category, self._api_prefix ) out = utils.SetUpCommandBuffer( cmd, category, self._api_prefix )
self._buffers[ category + '-out' ] = TabBuffer( out, self._buffers[ category ] = TabBuffer( out, len( self._buffers ) )
len( self._buffers ) ) self._buffers[ category ].is_job = True
self._buffers[ category + '-out' ].is_job = True self._RenderWinBar( category )
self._buffers[ category + '-out' ].job_category = category
self._buffers[ category + '-err' ] = TabBuffer( err,
len( self._buffers ) )
self._buffers[ category + '-err' ].is_job = False
self._RenderWinBar( category + '-out' )
self._RenderWinBar( category + '-err' )
else: else:
vim.command( 'enew' ) vim.command( 'enew' )
tab_buffer = TabBuffer( vim.current.buffer, len( self._buffers ) ) tab_buffer = TabBuffer( vim.current.buffer, len( self._buffers ) )
@ -218,10 +196,52 @@ class OutputView( object ):
raise raise
vim.command( "nnoremenu 1.{0} WinBar.{1}{2} " vim.command( "nnoremenu 1.{0} WinBar.{1}{2} "
":call vimspector#ShowOutput( '{1}' )<CR>".format( ":call vimspector#ShowOutputInWindow( {3}, '{1}' )<CR>".format(
tab_buffer.index, tab_buffer.index,
utils.Escape( category ), utils.Escape( category ),
'*' if tab_buffer.flag else '' ) ) '*' if tab_buffer.flag else '',
utils.WindowID( self._window ) ) )
def GetCategories( self ): def GetCategories( self ):
return list( self._buffers.keys() ) return list( self._buffers.keys() )
class DAPOutputView( OutputView ):
def __init__( self, *args ):
super().__init__( *args )
self._connection = None
for b in set( BUFFER_MAP.values() ):
self._CreateBuffer( b )
self._CreateBuffer( 'Vimspector', file_name = utils.LOG_FILE )
self._ShowOutput( 'Console' )
def ConnectionUp( self, connection ):
self._connection = connection
def ConnectionClosed( self ):
# Don't clear because output is probably still useful
self._connection = None
def Evaluate( self, frame, expression ):
self._Print( 'Console', [ 'Evaluating: ' + expression ] )
def print_result( message ):
result = message[ 'body' ][ 'result' ]
if result is None:
result = '<no result>'
self._Print( 'Console', f' Result: { result }' )
request = {
'command': 'evaluate',
'arguments': {
'expression': expression,
'context': 'repl',
}
}
if frame:
request[ 'arguments' ][ 'frameId' ] = frame[ 'id' ]
self._connection.DoRequest( print_result, request )

View file

@ -21,13 +21,13 @@ from vimspector import utils
class StackTraceView( object ): class StackTraceView( object ):
def __init__( self, session, connection, win ): def __init__( self, session, win ):
self._logger = logging.getLogger( __name__ ) self._logger = logging.getLogger( __name__ )
utils.SetUpLogging( self._logger ) utils.SetUpLogging( self._logger )
self._buf = win.buffer self._buf = win.buffer
self._session = session self._session = session
self._connection = connection self._connection = None
self._current_thread = None self._current_thread = None
self._current_frame = None self._current_frame = None

View file

@ -72,20 +72,18 @@ def OpenFileInCurrentWindow( file_name ):
def SetUpCommandBuffer( cmd, name, api_prefix ): def SetUpCommandBuffer( cmd, name, api_prefix ):
bufs = vim.eval( buf = Call( f'vimspector#internal#{api_prefix}job#StartCommandWithLog',
'vimspector#internal#{}job#StartCommandWithLog( {}, "{}" )'.format( cmd,
api_prefix, name )
json.dumps( cmd ),
name ) )
if bufs is None: if buf is None:
raise RuntimeError( "Unable to start job {}: {}".format( cmd, name ) ) raise RuntimeError( "Unable to start job {}: {}".format( cmd, name ) )
elif not all( int( b ) > 0 for b in bufs ): elif int( buf ) <= 0:
raise RuntimeError( "Unable to get all streams for job {}: {}".format( raise RuntimeError( "Unable to get all streams for job {}: {}".format(
name, name,
cmd ) ) cmd ) )
return [ vim.buffers[ int( b ) ] for b in bufs ] return vim.buffers[ int( buf ) ]
def CleanUpCommand( name, api_prefix ): def CleanUpCommand( name, api_prefix ):
@ -558,7 +556,6 @@ def Call( vimscript_function, *args ):
call += 'g:' + arg_name call += 'g:' + arg_name
call += ')' call += ')'
_logger.debug( 'Calling: {}'.format( call ) )
return vim.eval( call ) return vim.eval( call )
@ -633,16 +630,26 @@ def HideSplash( api_prefix, splash ):
return None return None
def GetVimString( vim_dict, name, default=None ):
# FIXME: use 'encoding' ?
try:
value = vim_dict[ name ]
except KeyError:
return default
if isinstance( value, bytes ):
return value.decode( 'utf-8' )
return value
def GetVimspectorBase(): def GetVimspectorBase():
base = vim.vars.get( 'vimspector_base_dir' ) return GetVimString( vim.vars,
if base is None: 'vimspector_base_dir',
return os.path.abspath( os.path.join( os.path.dirname( __file__ ), os.path.abspath(
'..', os.path.join( os.path.dirname( __file__ ),
'..' ) ) '..',
elif isinstance( base, bytes ): '..' ) ) )
return base.decode( 'utf-8' )
else:
return base
def GetUnusedLocalPort(): def GetUnusedLocalPort():
@ -655,5 +662,7 @@ def GetUnusedLocalPort():
return port return port
def WindowID( window, tab ): def WindowID( window, tab=None ):
if tab is None:
tab = window.tabpage
return int( Call( 'win_getid', window.number, tab.number ) ) return int( Call( 'win_getid', window.number, tab.number ) )

View file

@ -124,11 +124,11 @@ class View:
class VariablesView( object ): class VariablesView( object ):
def __init__( self, connection, variables_win, watches_win ): def __init__( self, variables_win, watches_win ):
self._logger = logging.getLogger( __name__ ) self._logger = logging.getLogger( __name__ )
utils.SetUpLogging( self._logger ) utils.SetUpLogging( self._logger )
self._connection = connection self._connection = None
self._current_syntax = '' self._current_syntax = ''
# Set up the "Variables" buffer in the variables_win # Set up the "Variables" buffer in the variables_win