Neovim support

This commit is contained in:
Ben Jackson 2020-07-21 22:48:26 +01:00
commit cd5ca37ce1
2 changed files with 66 additions and 55 deletions

View file

@ -147,11 +147,10 @@ function! vimspector#internal#job#Reset() abort
endfunction
function! s:_OnCommandExit( category, ch, code ) abort
py3 << EOF
from vimspector import utils as vimspector_utils
vimspector_utils.OnCommandWithLogComplete( vim.eval( 'a:category' ),
int( vim.eval( 'a:code' ) ) )
EOF
py3 __import__( "vimspector",
\ fromlist = [ "utils" ] ).utils.OnCommandWithLogComplete(
\ vim.eval( 'a:category' ),
\ int( vim.eval( 'a:code' ) ) )
endfunction
function! vimspector#internal#job#StartCommandWithLog( cmd, category ) abort

View file

@ -116,6 +116,7 @@ function! s:_OnCommandEvent( category, id, data, event ) abort
return
endif
if a:event ==# 'stdout' || a:event ==# 'stderr'
if a:data == ['']
return
endif
@ -164,11 +165,17 @@ function! s:_OnCommandEvent( category, id, data, event ) abort
let cw = winnr()
try
execute w . 'wincmd w'
normal! Gz.
normal! Gz-
finally
execute cw . 'wincmd w'
endtry
endif
elseif a:event ==# 'exit'
py3 __import__( "vimspector",
\ fromlist = [ "utils" ] ).utils.OnCommandWithLogComplete(
\ vim.eval( 'a:category' ),
\ int( vim.eval( 'a:data' ) ) )
endif
endfunction
function! s:SetUpHiddenBuffer( buffer ) abort
@ -210,7 +217,9 @@ function! vimspector#internal#neojob#StartCommandWithLog( cmd, category ) abort
\ 'on_stdout': funcref( 's:_OnCommandEvent',
\ [ a:category ] ),
\ 'on_stderr': funcref( 's:_OnCommandEvent',
\ [ a:category ] )
\ [ a:category ] ),
\ 'on_exit': funcref( 's:_OnCommandEvent',
\ [ a:category ] ),
\ } )
let s:commands[ a:category ][ id ] = {
@ -227,8 +236,11 @@ function! vimspector#internal#neojob#CleanUpCommand( category ) abort
endif
for id in keys( s:commands[ a:category ] )
call jobstop( str2nr( id ) )
call jobwait( [ str2nr( id ) ] )
let id = str2nr( id )
if jobwait( [ id ], 0 )[ 0 ] == -1
call jobstop( id )
endif
call jobwait( [ id ], -1 )
endfor
unlet! s:commands[ a:category ]
endfunction