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

@ -37,22 +37,11 @@ function! s:_OnClose( channel ) abort
py3 _vimspector_session.OnServerExit( 0 )
endfunction
function! s:_Send( msg ) abort
call ch_sendraw( s:ch, a:msg )
return 1
endfunction
function! vimspector#internal#channel#Timeout( id ) abort
py3 << EOF
_vimspector_session.OnRequestTimeout( vim.eval( 'a:id' ) )
EOF
endfunction
function! vimspector#internal#channel#StartDebugSession( config ) abort
if exists( 's:ch' )
echo 'Channel is already running'
return v:none
return v:false
endif
let l:addr = 'localhost:' . a:config[ 'port' ]
@ -70,10 +59,21 @@ function! vimspector#internal#channel#StartDebugSession( config ) abort
if ch_status( s:ch ) !=# 'open'
echom 'Unable to connect to debug adapter'
redraw
return v:none
return v:false
endif
return funcref( 's:_Send' )
return v:true
endfunction
function! vimspector#internal#channel#Send( msg ) abort
call ch_sendraw( s:ch, a:msg )
return 1
endfunction
function! vimspector#internal#channel#Timeout( id ) abort
py3 << EOF
_vimspector_session.OnRequestTimeout( vim.eval( 'a:id' ) )
EOF
endfunction
function! vimspector#internal#channel#StopDebugSession() abort

View file

@ -39,35 +39,11 @@ function! s:_OnClose( channel ) abort
redraw
endfunction
function! s:_Send( msg ) abort
if ! exists( 's:job' )
echom "Can't send message: Job was not initialised correctly"
redraw
return 0
endif
if job_status( s:job ) !=# 'run'
echom "Can't send message: Job is not running"
redraw
return 0
endif
let ch = job_getchannel( s:job )
if ch ==# 'channel fail'
echom 'Channel was closed unexpectedly!'
redraw
return 0
endif
call ch_sendraw( ch, a:msg )
return 1
endfunction
function! vimspector#internal#job#StartDebugSession( config ) abort
if exists( 's:job' )
echom 'Not starging: Job is already running'
redraw
return v:none
return v:false
endif
let s:job = job_start( a:config[ 'command' ],
@ -91,10 +67,34 @@ function! vimspector#internal#job#StartDebugSession( config ) abort
if job_status( s:job ) !=# 'run'
echom 'Unable to start job, status is: ' . job_status( s:job )
redraw
return v:none
return v:false
endif
return funcref( 's:_Send' )
return v:true
endfunction
function! vimspector#internal#job#Send( msg ) abort
if ! exists( 's:job' )
echom "Can't send message: Job was not initialised correctly"
redraw
return 0
endif
if job_status( s:job ) !=# 'run'
echom "Can't send message: Job is not running"
redraw
return 0
endif
let ch = job_getchannel( s:job )
if ch ==# 'channel fail'
echom 'Channel was closed unexpectedly!'
redraw
return 0
endif
call ch_sendraw( ch, a:msg )
return 1
endfunction
function! vimspector#internal#job#StopDebugSession() abort