Add :VimspectorUpdate

This commit is contained in:
Ben Jackson 2020-07-22 12:50:44 +01:00
commit 4144631d03
4 changed files with 33 additions and 0 deletions

View file

@ -453,6 +453,11 @@ which can be used to check everything is working. This is used by the regression
tests in CI so should always work, and is a good way to check if the problem is
your configuration rather than a bug.
## Upgrade
After updating the Vimspector code (either via `git pull` or whatever pacakge
manager), run `:VimspectorUpdate` to update any already-installed gadets.
# About
## Background

View file

@ -256,6 +256,17 @@ function! vimspector#CompleteInstall( ArgLead, CmdLine, CursorPos ) abort
\ . ')' )
endfunction
function! vimspector#Update() abort
if !s:enabled
return
endif
let prefix = vimspector#internal#state#GetAPIPrefix()
py3 __import__( 'vimspector',
\ fromlist = [ 'installer' ] ).installer.RunUpdate(
\ vim.eval( 'prefix' ) )
endfunction
" Boilerplate {{{
let &cpoptions=s:save_cpo
unlet s:save_cpo

View file

@ -102,6 +102,10 @@ command! -bar
command! -bar -nargs=* -complete=custom,vimspector#CompleteInstall
\ VimspectorInstall
\ call vimspector#Install( <f-args> )
command! -bar -nargs=0
\ VimspectorUpdate
\ call vimspector#Update()
" Dummy autocommands so that we can call this whenever

View file

@ -132,6 +132,19 @@ def RunInstaller( api_prefix, *args, **kwargs ):
OUTPUT_VIEW.ShowOutput( 'Installer' )
def RunUpdate( api_prefix ):
from vimspector import utils
Configure( vimspector_base = utils.GetVimspectorBase() )
current_adapters = ReadAdapters( read_existing = True )
adapters = []
for adapter_name in current_adapters.keys():
adapters.extend( FindGadgetForAdapter( adapter_name ) )
if adapters:
RunInstaller( api_prefix, *adapters )
def GadgetListToInstallerArgs( *gadget_list ):
installer_args = []
for name in gadget_list: