Close the intaller output when complete
This commit is contained in:
parent
ca4ab52f8d
commit
05bbafd60c
3 changed files with 47 additions and 14 deletions
|
|
@ -133,11 +133,10 @@ function! vimspector#ShowOutput( category ) abort
|
|||
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
|
||||
py3 __import__( 'vimspector',
|
||||
\ fromlist = [ 'output' ] ).output.ShowOutputInWindow(
|
||||
\ int( vim.eval( 'a:win_id' ) ),
|
||||
\ vim.eval( 'a:category' ) )
|
||||
endfunction
|
||||
|
||||
function! vimspector#ListBreakpoints() abort
|
||||
|
|
@ -163,10 +162,17 @@ function! vimspector#Install( ... ) abort
|
|||
return
|
||||
endif
|
||||
let prefix = vimspector#internal#state#GetAPIPrefix()
|
||||
py3 << EOF
|
||||
from vimspector import installer as vimspector_installer
|
||||
vimspector_installer.RunInstaller( vim.eval( 'prefix' ), *vim.eval( 'a:000' ) )
|
||||
EOF
|
||||
py3 __import__( 'vimspector',
|
||||
\ fromlist = [ 'installer' ] ).installer.RunInstaller(
|
||||
\ vim.eval( 'prefix' ),
|
||||
\ *vim.eval( 'a:000' ) )
|
||||
endfunction
|
||||
|
||||
function! vimspector#CompleteInstall( ArgLead, CmdLine, CursorPos ) abort
|
||||
return py3eval( '"\n".join('
|
||||
\ . '__import__( "vimspector", fromlist = [ "gadgets" ] )'
|
||||
\ . '.gadgets.GADGETS.keys() '
|
||||
\ . ')' )
|
||||
endfunction
|
||||
|
||||
" Boilerplate {{{
|
||||
|
|
|
|||
|
|
@ -99,10 +99,11 @@ command! -bar
|
|||
\ call vimspector#Reset()
|
||||
|
||||
" Installer commands
|
||||
command! -bar -nargs=*
|
||||
command! -bar -nargs=* -complete=custom,vimspector#CompleteInstall
|
||||
\ VimspectorInstall
|
||||
\ call vimspector#Install( <f-args> )
|
||||
|
||||
|
||||
" Dummy autocommands so that we can call this whenever
|
||||
augroup VimspectorUserAutoCmds
|
||||
au!
|
||||
|
|
|
|||
|
|
@ -85,12 +85,13 @@ def RunInstaller( api_prefix, *args ):
|
|||
from vimspector import utils, output, settings
|
||||
import vim
|
||||
|
||||
args = GadgetListToInstallerArgs( *args )
|
||||
|
||||
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
|
||||
|
|
@ -112,10 +113,14 @@ def RunInstaller( api_prefix, *args ):
|
|||
|
||||
def handler( exit_code ):
|
||||
if exit_code == 0:
|
||||
utils.UserMessage( "Vimspector installation complete!" )
|
||||
vim.command( 'doautocmd User VimspectorInstallSuccess' )
|
||||
global OUTPUT_VIEW
|
||||
if OUTPUT_VIEW:
|
||||
OUTPUT_VIEW.Reset()
|
||||
OUTPUT_VIEW = None
|
||||
utils.UserMessage( "Vimspector gadget installation complete!" )
|
||||
vim.command( 'silent doautocmd User VimspectorInstallSuccess' )
|
||||
else:
|
||||
utils.UserMessage( 'Vimspector installation reported errors',
|
||||
utils.UserMessage( 'Vimspector gadget installation reported errors',
|
||||
error = True )
|
||||
vim.command( 'silent doautocmd User VimspectorInstallFailed' )
|
||||
|
||||
|
|
@ -126,6 +131,27 @@ def RunInstaller( api_prefix, *args ):
|
|||
OUTPUT_VIEW.ShowOutput( 'Installer' )
|
||||
|
||||
|
||||
def GadgetListToInstallerArgs( *gadget_list ):
|
||||
installer_args = []
|
||||
from vimspector import gadgets
|
||||
for name in gadget_list:
|
||||
if name.startswith( '-' ):
|
||||
installer_args.append( name )
|
||||
continue
|
||||
|
||||
try:
|
||||
gadget = gadgets.GADGETS[ name ]
|
||||
except KeyError:
|
||||
continue
|
||||
|
||||
if not gadget.get( 'enabled', True ):
|
||||
installer_args.append( f'--force-enable-{ gadget[ "language" ] }' )
|
||||
else:
|
||||
installer_args.append( f'--enable-{ gadget[ "language" ] }' )
|
||||
|
||||
return installer_args
|
||||
|
||||
|
||||
# def Install( languages, force ):
|
||||
# all_enabled = 'all' in languages
|
||||
# force_all = all_enabled and force
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue