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' ) )
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
py3 _vimspector_session.ListBreakpoints()
endfunction
@ -154,48 +162,13 @@ function! vimspector#Install( ... ) abort
if a:0 < 1
return
endif
let gadgets = a:000
let force = a:1 ==# '--force'
if force
let gadgets = a:000[ 1: ]
endif
let prefix = vimspector#internal#state#GetAPIPrefix()
py3 << EOF
from vimspector import installer as vimspector_installer
from vimspector import utils as vimspector_utils
vimspector_installer.Configure(
vimspector_base = vimspector_utils.GetVimspectorBase() )
vimspector_installer.Install( vim.eval( 'gadgets'), vim.eval( 'force' ) )
vimspector_installer.RunInstaller( vim.eval( 'prefix' ), *vim.eval( 'a:000' ) )
EOF
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 {{{
let &cpoptions=s:save_cpo
unlet s:save_cpo