Remove use of bindeval() as it is not suported in neovim

This commit is contained in:
Ben Jackson 2020-01-08 13:51:03 +00:00
commit dcdab63516
4 changed files with 62 additions and 49 deletions

View file

@ -492,19 +492,18 @@ class DebugSession( object ):
self._adapter[ 'cwd' ] = os.getcwd()
vim.vars[ '_vimspector_adapter_spec' ] = self._adapter
channel_send_func = vim.bindeval(
"vimspector#internal#{}#StartDebugSession( "
" g:_vimspector_adapter_spec "
")".format( self._connection_type ) )
if channel_send_func is None:
if not vim.eval( "vimspector#internal#{}#StartDebugSession( "
" g:_vimspector_adapter_spec "
")".format( self._connection_type ) ):
self._logger.error( "Unable to start debug server" )
else:
self._connection = debug_adapter_connection.DebugAdapterConnection(
self,
channel_send_func )
lambda msg: utils.Call(
"vimspector#internal#{}#Send".format( self._connection_type ),
msg ) )
self._logger.info( 'Debug Adapter Started' )
self._logger.info( 'Debug Adapter Started' )
def _StopDebugAdapter( self, callback = None ):
def handler( *args ):

View file

@ -449,3 +449,17 @@ def ToUnicode( b ):
if isinstance( b, bytes ):
return b.decode( 'utf-8' )
return b
# Call a vimscript function with suplied arguments.
def Call( vimscript_function, *args ):
call = vimscript_function + '('
for index, arg in enumerate( args ):
arg_name = 'vimspector_internal_arg_{}'.format( index )
vim.vars[ arg_name ] = arg
call += 'g:' + arg_name
if index:
call += ','
call += ')'
vim.eval( call )