Allow forcing selection from the menu with <leader>F5
This commit is contained in:
parent
f4831657b8
commit
32360236ff
3 changed files with 11 additions and 3 deletions
|
|
@ -41,11 +41,11 @@ function! s:Enabled() abort
|
||||||
return s:enabled
|
return s:enabled
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! vimspector#Launch() abort
|
function! vimspector#Launch( ... ) abort
|
||||||
if !s:Enabled()
|
if !s:Enabled()
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
py3 _vimspector_session.Start()
|
py3 _vimspector_session.Start( *vim.eval( 'a:000' ) )
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! vimspector#LaunchWithSettings( settings ) abort
|
function! vimspector#LaunchWithSettings( settings ) abort
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,8 @@ let s:mappings = get( g:, 'vimspector_enable_mappings', '' )
|
||||||
|
|
||||||
nnoremap <silent> <Plug>VimspectorContinue
|
nnoremap <silent> <Plug>VimspectorContinue
|
||||||
\ :<c-u>call vimspector#Continue()<CR>
|
\ :<c-u>call vimspector#Continue()<CR>
|
||||||
|
nnoremap <silent> <Plug>VimspectorLaunch
|
||||||
|
\ :<c-u>call vimspector#Launch( v:true )<CR>
|
||||||
nnoremap <silent> <Plug>VimspectorStop
|
nnoremap <silent> <Plug>VimspectorStop
|
||||||
\ :<c-u>call vimspector#Stop()<CR>
|
\ :<c-u>call vimspector#Stop()<CR>
|
||||||
nnoremap <silent> <Plug>VimspectorRestart
|
nnoremap <silent> <Plug>VimspectorRestart
|
||||||
|
|
@ -79,6 +81,7 @@ if s:mappings ==# 'VISUAL_STUDIO'
|
||||||
nmap <S-F11> <Plug>VimspectorStepOut
|
nmap <S-F11> <Plug>VimspectorStepOut
|
||||||
elseif s:mappings ==# 'HUMAN'
|
elseif s:mappings ==# 'HUMAN'
|
||||||
nmap <F5> <Plug>VimspectorContinue
|
nmap <F5> <Plug>VimspectorContinue
|
||||||
|
nmap <leader><F5> <Plug>VimspectorLaunch
|
||||||
nmap <F3> <Plug>VimspectorStop
|
nmap <F3> <Plug>VimspectorStop
|
||||||
nmap <F4> <Plug>VimspectorRestart
|
nmap <F4> <Plug>VimspectorRestart
|
||||||
nmap <F6> <Plug>VimspectorPause
|
nmap <F6> <Plug>VimspectorPause
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ class DebugSession( object ):
|
||||||
|
|
||||||
return launch_config_file, configurations
|
return launch_config_file, configurations
|
||||||
|
|
||||||
def Start( self, launch_variables = None ):
|
def Start( self, force_choose=False, launch_variables = None ):
|
||||||
# We mutate launch_variables, so don't mutate the default argument.
|
# We mutate launch_variables, so don't mutate the default argument.
|
||||||
# https://docs.python-guide.org/writing/gotchas/#mutable-default-arguments
|
# https://docs.python-guide.org/writing/gotchas/#mutable-default-arguments
|
||||||
if launch_variables is None:
|
if launch_variables is None:
|
||||||
|
|
@ -135,6 +135,11 @@ class DebugSession( object ):
|
||||||
|
|
||||||
if 'configuration' in launch_variables:
|
if 'configuration' in launch_variables:
|
||||||
configuration_name = launch_variables.pop( 'configuration' )
|
configuration_name = launch_variables.pop( 'configuration' )
|
||||||
|
elif force_choose:
|
||||||
|
# Always display the menu
|
||||||
|
configuration_name = utils.SelectFromList(
|
||||||
|
'Which launch configuration?',
|
||||||
|
sorted( configurations.keys() ) )
|
||||||
elif ( len( configurations ) == 1 and
|
elif ( len( configurations ) == 1 and
|
||||||
next( iter( configurations.values() ) ).get( "autoselect", True ) ):
|
next( iter( configurations.values() ) ).get( "autoselect", True ) ):
|
||||||
configuration_name = next( iter( configurations.keys() ) )
|
configuration_name = next( iter( configurations.keys() ) )
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue