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
|
endfunction
|
||||||
|
|
||||||
function! vimspector#ShowOutputInWindow( win_id, category ) abort
|
function! vimspector#ShowOutputInWindow( win_id, category ) abort
|
||||||
py3 <<EOF
|
py3 __import__( 'vimspector',
|
||||||
from vimspector import output as vimspector_output
|
\ fromlist = [ 'output' ] ).output.ShowOutputInWindow(
|
||||||
vimspector_output.ShowOutputInWindow( int( vim.eval( 'a:win_id' ) ),
|
\ int( vim.eval( 'a:win_id' ) ),
|
||||||
vim.eval( 'a:category' ) )
|
\ vim.eval( 'a:category' ) )
|
||||||
EOF
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! vimspector#ListBreakpoints() abort
|
function! vimspector#ListBreakpoints() abort
|
||||||
|
|
@ -163,10 +162,17 @@ function! vimspector#Install( ... ) abort
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
let prefix = vimspector#internal#state#GetAPIPrefix()
|
let prefix = vimspector#internal#state#GetAPIPrefix()
|
||||||
py3 << EOF
|
py3 __import__( 'vimspector',
|
||||||
from vimspector import installer as vimspector_installer
|
\ fromlist = [ 'installer' ] ).installer.RunInstaller(
|
||||||
vimspector_installer.RunInstaller( vim.eval( 'prefix' ), *vim.eval( 'a:000' ) )
|
\ vim.eval( 'prefix' ),
|
||||||
EOF
|
\ *vim.eval( 'a:000' ) )
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! vimspector#CompleteInstall( ArgLead, CmdLine, CursorPos ) abort
|
||||||
|
return py3eval( '"\n".join('
|
||||||
|
\ . '__import__( "vimspector", fromlist = [ "gadgets" ] )'
|
||||||
|
\ . '.gadgets.GADGETS.keys() '
|
||||||
|
\ . ')' )
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Boilerplate {{{
|
" Boilerplate {{{
|
||||||
|
|
|
||||||
|
|
@ -99,10 +99,11 @@ command! -bar
|
||||||
\ call vimspector#Reset()
|
\ call vimspector#Reset()
|
||||||
|
|
||||||
" Installer commands
|
" Installer commands
|
||||||
command! -bar -nargs=*
|
command! -bar -nargs=* -complete=custom,vimspector#CompleteInstall
|
||||||
\ VimspectorInstall
|
\ VimspectorInstall
|
||||||
\ call vimspector#Install( <f-args> )
|
\ call vimspector#Install( <f-args> )
|
||||||
|
|
||||||
|
|
||||||
" Dummy autocommands so that we can call this whenever
|
" Dummy autocommands so that we can call this whenever
|
||||||
augroup VimspectorUserAutoCmds
|
augroup VimspectorUserAutoCmds
|
||||||
au!
|
au!
|
||||||
|
|
|
||||||
|
|
@ -85,12 +85,13 @@ def RunInstaller( api_prefix, *args ):
|
||||||
from vimspector import utils, output, settings
|
from vimspector import utils, output, settings
|
||||||
import vim
|
import vim
|
||||||
|
|
||||||
|
args = GadgetListToInstallerArgs( *args )
|
||||||
|
|
||||||
vimspector_home = utils.GetVimString( vim.vars, 'vimspector_home' )
|
vimspector_home = utils.GetVimString( vim.vars, 'vimspector_home' )
|
||||||
vimspector_base_dir = utils.GetVimspectorBase()
|
vimspector_base_dir = utils.GetVimspectorBase()
|
||||||
|
|
||||||
# TODO: Translate the arguments to something more user-friendly than -- args
|
# TODO: Translate the arguments to something more user-friendly than -- args
|
||||||
global OUTPUT_VIEW
|
global OUTPUT_VIEW
|
||||||
|
|
||||||
if OUTPUT_VIEW:
|
if OUTPUT_VIEW:
|
||||||
OUTPUT_VIEW.Reset()
|
OUTPUT_VIEW.Reset()
|
||||||
OUTPUT_VIEW = None
|
OUTPUT_VIEW = None
|
||||||
|
|
@ -112,10 +113,14 @@ def RunInstaller( api_prefix, *args ):
|
||||||
|
|
||||||
def handler( exit_code ):
|
def handler( exit_code ):
|
||||||
if exit_code == 0:
|
if exit_code == 0:
|
||||||
utils.UserMessage( "Vimspector installation complete!" )
|
global OUTPUT_VIEW
|
||||||
vim.command( 'doautocmd User VimspectorInstallSuccess' )
|
if OUTPUT_VIEW:
|
||||||
|
OUTPUT_VIEW.Reset()
|
||||||
|
OUTPUT_VIEW = None
|
||||||
|
utils.UserMessage( "Vimspector gadget installation complete!" )
|
||||||
|
vim.command( 'silent doautocmd User VimspectorInstallSuccess' )
|
||||||
else:
|
else:
|
||||||
utils.UserMessage( 'Vimspector installation reported errors',
|
utils.UserMessage( 'Vimspector gadget installation reported errors',
|
||||||
error = True )
|
error = True )
|
||||||
vim.command( 'silent doautocmd User VimspectorInstallFailed' )
|
vim.command( 'silent doautocmd User VimspectorInstallFailed' )
|
||||||
|
|
||||||
|
|
@ -126,6 +131,27 @@ def RunInstaller( api_prefix, *args ):
|
||||||
OUTPUT_VIEW.ShowOutput( 'Installer' )
|
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 ):
|
# def Install( languages, force ):
|
||||||
# all_enabled = 'all' in languages
|
# all_enabled = 'all' in languages
|
||||||
# force_all = all_enabled and force
|
# force_all = all_enabled and force
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue