Add bang versions of install commands to leave the output open
This commit is contained in:
parent
357e112cdf
commit
29cb5c914b
5 changed files with 33 additions and 12 deletions
21
README.md
21
README.md
|
|
@ -16,9 +16,12 @@ For a tutorial and usage overview, take a look at the
|
|||
* [Windows differences](#windows-differences)
|
||||
* [Clone the plugin](#clone-the-plugin)
|
||||
* [Install some gadgets](#install-some-gadgets)
|
||||
* [VimspectorInstall and VimspectorUpdate commands](#vimspectorinstall-and-vimspectorupdate-commands)
|
||||
* [install_gadget.py](#install_gadgetpy)
|
||||
* [Manual gadget installation](#manual-gadget-installation)
|
||||
* [The gadget directory](#the-gadget-directory)
|
||||
* [Trying it out](#trying-it-out)
|
||||
* [Upgrade](#upgrade)
|
||||
* [About](#about)
|
||||
* [Background](#background)
|
||||
* [Status](#status)
|
||||
|
|
@ -71,7 +74,7 @@ For a tutorial and usage overview, take a look at the
|
|||
* [License](#license)
|
||||
* [Sponsorship](#sponsorship)
|
||||
|
||||
<!-- Added by: ben, at: Wed 22 Jul 2020 12:38:39 BST -->
|
||||
<!-- Added by: ben, at: Wed 22 Jul 2020 22:10:50 BST -->
|
||||
|
||||
<!--te-->
|
||||
|
||||
|
|
@ -307,9 +310,23 @@ To install the tested debug adapter for a language, run:
|
|||
| Supported and experimental adapters | `./install_gadget.py --all --force-all` | `:VimspectorInstall --all` |
|
||||
| Adapter for specific debug config | | Suggested by Vimspector when starting debugging |
|
||||
|
||||
`"VimspectorInstall` runs `install_gadget.py` in the background with some of
|
||||
### VimspectorInstall and VimspectorUpdate commands
|
||||
|
||||
`:VimspectorInstall` runs `install_gadget.py` in the background with some of
|
||||
the options defaulted.
|
||||
|
||||
`:VimspectorUpdate` runs `install_gadget.py` to re-install (i.e. update) any
|
||||
gadgets already installed in your `.gadgets.json`.
|
||||
|
||||
The output is minimal, to see the full output add `--verbose` to the command, as
|
||||
in `:VimspectorInstall --verbose ...` or `:VimspectorUpdate --verbose ...`.
|
||||
|
||||
If the installation is successful, the output window is closed (and the output
|
||||
lost forever). Use a `!` to keep it open (e.g. `:VimspectorInstall! --verbose
|
||||
--all` or `:VimspectorUpdate!` (etc.).
|
||||
|
||||
### install\_gadget.py
|
||||
|
||||
By default `install_gadget.py` will overwrite your `.gadgets.json` with the set
|
||||
of adapters just installed, whereas `:VimspectorInstall` will _update_ it,
|
||||
overwriting only newly changed or installed adapters.
|
||||
|
|
|
|||
|
|
@ -232,7 +232,7 @@ function! vimspector#CompleteExpr( ArgLead, CmdLine, CursorPos ) abort
|
|||
\ "\n" )
|
||||
endfunction
|
||||
|
||||
function! vimspector#Install( ... ) abort
|
||||
function! vimspector#Install( bang, ... ) abort
|
||||
if !s:enabled
|
||||
return
|
||||
endif
|
||||
|
|
@ -243,6 +243,7 @@ function! vimspector#Install( ... ) abort
|
|||
py3 __import__( 'vimspector',
|
||||
\ fromlist = [ 'installer' ] ).installer.RunInstaller(
|
||||
\ vim.eval( 'prefix' ),
|
||||
\ vim.eval( 'a:bang' ) == '!',
|
||||
\ *vim.eval( 'a:000' ) )
|
||||
endfunction
|
||||
|
||||
|
|
@ -256,7 +257,7 @@ function! vimspector#CompleteInstall( ArgLead, CmdLine, CursorPos ) abort
|
|||
\ . ')' )
|
||||
endfunction
|
||||
|
||||
function! vimspector#Update( ... ) abort
|
||||
function! vimspector#Update( bang, ... ) abort
|
||||
if !s:enabled
|
||||
return
|
||||
endif
|
||||
|
|
@ -265,6 +266,7 @@ function! vimspector#Update( ... ) abort
|
|||
py3 __import__( 'vimspector',
|
||||
\ fromlist = [ 'installer' ] ).installer.RunUpdate(
|
||||
\ vim.eval( 'prefix' ),
|
||||
\ vim.eval( 'a:bang' ) == '!',
|
||||
\ *vim.eval( 'a:000' ) )
|
||||
endfunction
|
||||
|
||||
|
|
|
|||
|
|
@ -99,12 +99,12 @@ command! -bar
|
|||
\ call vimspector#Reset()
|
||||
|
||||
" Installer commands
|
||||
command! -bar -nargs=* -complete=custom,vimspector#CompleteInstall
|
||||
command! -bar -bang -nargs=* -complete=custom,vimspector#CompleteInstall
|
||||
\ VimspectorInstall
|
||||
\ call vimspector#Install( <f-args> )
|
||||
command! -bar -nargs=*
|
||||
\ call vimspector#Install( <q-bang>, <f-args> )
|
||||
command! -bar -bang -nargs=*
|
||||
\ VimspectorUpdate
|
||||
\ call vimspector#Update( <f-args> )
|
||||
\ call vimspector#Update( <q-bang>, <f-args> )
|
||||
command! -bar -nargs=0
|
||||
\ VimspectorAbortInstall
|
||||
\ call vimspector#AbortInstall()
|
||||
|
|
|
|||
|
|
@ -164,6 +164,7 @@ class DebugSession( object ):
|
|||
|
||||
installer.RunInstaller(
|
||||
self._api_prefix,
|
||||
False, # Don't leave open
|
||||
*shlex.split( response ),
|
||||
then = lambda: self.Start( new_launch_variables ) )
|
||||
return
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ def PathToAnyWorkingPython3():
|
|||
raise RuntimeError( "Unable to find a working python3" )
|
||||
|
||||
|
||||
def RunInstaller( api_prefix, *args, **kwargs ):
|
||||
def RunInstaller( api_prefix, leave_open, *args, **kwargs ):
|
||||
from vimspector import utils, output, settings
|
||||
import vim
|
||||
|
||||
|
|
@ -125,7 +125,8 @@ def RunInstaller( api_prefix, *args, **kwargs ):
|
|||
|
||||
def handler( exit_code ):
|
||||
if exit_code == 0:
|
||||
_ResetInstaller()
|
||||
if not leave_open:
|
||||
_ResetInstaller()
|
||||
utils.UserMessage( "Vimspector gadget installation complete!" )
|
||||
vim.command( 'silent doautocmd User VimspectorInstallSuccess' )
|
||||
if 'then' in kwargs:
|
||||
|
|
@ -143,7 +144,7 @@ def RunInstaller( api_prefix, *args, **kwargs ):
|
|||
OUTPUT_VIEW.ShowOutput( 'Installer' )
|
||||
|
||||
|
||||
def RunUpdate( api_prefix, *args ):
|
||||
def RunUpdate( api_prefix, leave_open, *args ):
|
||||
from vimspector import utils
|
||||
Configure( vimspector_base = utils.GetVimspectorBase() )
|
||||
|
||||
|
|
@ -153,7 +154,7 @@ def RunUpdate( api_prefix, *args ):
|
|||
args.extend( FindGadgetForAdapter( adapter_name ) )
|
||||
|
||||
if args:
|
||||
RunInstaller( api_prefix, *args )
|
||||
RunInstaller( api_prefix, leave_open, *args )
|
||||
|
||||
|
||||
def _ResetInstaller():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue