Compare commits
2 commits
master
...
force-laun
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f3f458cdc7 | ||
|
|
7723d58cf8 |
5 changed files with 65 additions and 26 deletions
51
README.md
51
README.md
|
|
@ -695,17 +695,17 @@ loading vimspector**:
|
|||
let g:vimspector_enable_mappings = 'VISUAL_STUDIO'
|
||||
```
|
||||
|
||||
| Key | Function | API |
|
||||
| --- | --- | --- |
|
||||
| `F5` | When debugging, continue. Otherwise start debugging. | `vimspector#Continue()` |
|
||||
| `Shift F5` | Stop debugging. | `vimspector#Stop()` |
|
||||
| `Ctrl Shift F5` | Restart debugging with the same configuration. | `vimspector#Restart()` |
|
||||
| `F6` | Pause debuggee. | `vimspector#Pause()` |
|
||||
| `F9` | Toggle line breakpoint on the current line. | `vimspector#ToggleBreakpoint()` |
|
||||
| `Shift F9` | Add a function breakpoint for the expression under cursor | `vimspector#AddFunctionBreakpoint( '<cexpr>' )` |
|
||||
| `F10` | Step Over | `vimspector#StepOver()` |
|
||||
| `F11` | Step Into | `vimspector#StepInto()` |
|
||||
| `Shift F11` | Step out of current function scope | `vimspector#StepOut()` |
|
||||
| Key | Function | API |
|
||||
| --- | --- | --- |
|
||||
| `F5` | When debugging, continue. Otherwise start debugging. | `vimspector#Continue()` |
|
||||
| `Shift F5` | Stop debugging. | `vimspector#Stop()` |
|
||||
| `Ctrl Shift F5` | Restart debugging with the same configuration. | `vimspector#Restart()` |
|
||||
| `F6` | Pause debuggee. | `vimspector#Pause()` |
|
||||
| `F9` | Toggle line breakpoint on the current line. | `vimspector#ToggleBreakpoint()` |
|
||||
| `Shift F9` | Add a function breakpoint for the expression under cursor | `vimspector#AddFunctionBreakpoint( '<cexpr>' )` |
|
||||
| `F10` | Step Over | `vimspector#StepOver()` |
|
||||
| `F11` | Step Into | `vimspector#StepInto()` |
|
||||
| `Shift F11` | Step out of current function scope | `vimspector#StepOut()` |
|
||||
|
||||
## Human Mode
|
||||
|
||||
|
|
@ -720,19 +720,20 @@ loading vimspector**:
|
|||
let g:vimspector_enable_mappings = 'HUMAN'
|
||||
```
|
||||
|
||||
| Key | Function | API |
|
||||
| --- | --- | --- |
|
||||
| `F5` | When debugging, continue. Otherwise start debugging. | `vimspector#Continue()` |
|
||||
| `F3` | Stop debugging. | `vimspector#Stop()` |
|
||||
| `F4` | Restart debugging with the same configuration. | `vimspector#Restart()` |
|
||||
| `F6` | Pause debuggee. | `vimspector#Pause()` |
|
||||
| `F9` | Toggle line breakpoint on the current line. | `vimspector#ToggleBreakpoint()` |
|
||||
| Key | Function | API |
|
||||
| --- | --- | --- |
|
||||
| `F5` | When debugging, continue. Otherwise start debugging. | `vimspector#Continue()` |
|
||||
| `<Leader>F5` | Start debugging, do not default the debug profile | `vimspector#Launch( v:true )` |
|
||||
| `F3` | Stop debugging. | `vimspector#Stop()` |
|
||||
| `F4` | Restart debugging with the same configuration. | `vimspector#Restart()` |
|
||||
| `F6` | Pause debuggee. | `vimspector#Pause()` |
|
||||
| `F9` | Toggle line breakpoint on the current line. | `vimspector#ToggleBreakpoint()` |
|
||||
| `<leader>F9` | Toggle conditional line breakpoint on the current line. | `vimspector#ToggleBreakpoint( { trigger expr, hit count expr } )` |
|
||||
| `F8` | Add a function breakpoint for the expression under cursor | `vimspector#AddFunctionBreakpoint( '<cexpr>' )` |
|
||||
| `<leader>F8` | Run to Cursor | `vimspector#RunToCursor()` |
|
||||
| `F10` | Step Over | `vimspector#StepOver()` |
|
||||
| `F11` | Step Into | `vimspector#StepInto()` |
|
||||
| `F12` | Step out of current function scope | `vimspector#StepOut()` |
|
||||
| `F8` | Add a function breakpoint for the expression under cursor | `vimspector#AddFunctionBreakpoint( '<cexpr>' )` |
|
||||
| `<leader>F8` | Run to Cursor | `vimspector#RunToCursor()` |
|
||||
| `F10` | Step Over | `vimspector#StepOver()` |
|
||||
| `F11` | Step Into | `vimspector#StepInto()` |
|
||||
| `F12` | Step out of current function scope | `vimspector#StepOut()` |
|
||||
|
||||
In addition, I recommend adding a mapping to `<Plug>VimspectorBalloonEval`, in
|
||||
normal and visual modes, for example:
|
||||
|
|
@ -746,6 +747,10 @@ nmap <Leader>di <Plug>VimspectorBalloonEval
|
|||
xmap <Leader>di <Plug>VimspectorBalloonEval
|
||||
```
|
||||
|
||||
If you would like to have custom mappings, or mappings active only while
|
||||
debugging, then take a look at the
|
||||
[customisation sectoin](#custom-mappings-while-debugging).
|
||||
|
||||
# Usage and API
|
||||
|
||||
This section defines detailed usage instructions, organised by feature. For most
|
||||
|
|
|
|||
|
|
@ -41,11 +41,11 @@ function! s:Enabled() abort
|
|||
return s:enabled
|
||||
endfunction
|
||||
|
||||
function! vimspector#Launch() abort
|
||||
function! vimspector#Launch( ... ) abort
|
||||
if !s:Enabled()
|
||||
return
|
||||
endif
|
||||
py3 _vimspector_session.Start()
|
||||
py3 _vimspector_session.Start( *vim.eval( 'a:000' ) )
|
||||
endfunction
|
||||
|
||||
function! vimspector#LaunchWithSettings( settings ) abort
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ let s:mappings = get( g:, 'vimspector_enable_mappings', '' )
|
|||
|
||||
nnoremap <silent> <Plug>VimspectorContinue
|
||||
\ :<c-u>call vimspector#Continue()<CR>
|
||||
nnoremap <silent> <Plug>VimspectorLaunch
|
||||
\ :<c-u>call vimspector#Launch( v:true )<CR>
|
||||
nnoremap <silent> <Plug>VimspectorStop
|
||||
\ :<c-u>call vimspector#Stop()<CR>
|
||||
nnoremap <silent> <Plug>VimspectorRestart
|
||||
|
|
@ -79,6 +81,7 @@ if s:mappings ==# 'VISUAL_STUDIO'
|
|||
nmap <S-F11> <Plug>VimspectorStepOut
|
||||
elseif s:mappings ==# 'HUMAN'
|
||||
nmap <F5> <Plug>VimspectorContinue
|
||||
nmap <leader><F5> <Plug>VimspectorLaunch
|
||||
nmap <F3> <Plug>VimspectorStop
|
||||
nmap <F4> <Plug>VimspectorRestart
|
||||
nmap <F6> <Plug>VimspectorPause
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ class DebugSession( object ):
|
|||
|
||||
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.
|
||||
# https://docs.python-guide.org/writing/gotchas/#mutable-default-arguments
|
||||
if launch_variables is None:
|
||||
|
|
@ -134,6 +134,11 @@ class DebugSession( object ):
|
|||
|
||||
if 'configuration' in launch_variables:
|
||||
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
|
||||
next( iter( configurations.values() ) ).get( "autoselect", True ) ):
|
||||
configuration_name = next( iter( configurations.keys() ) )
|
||||
|
|
|
|||
|
|
@ -141,3 +141,29 @@ function! Test_Use_Mappings_HUMAN()
|
|||
%bwipeout!
|
||||
endfunction
|
||||
|
||||
|
||||
function! SetUp_Test_Use_Mappings_HUMAN_ForceMenu()
|
||||
let g:vimspector_enable_mappings = 'HUMAN'
|
||||
endfunction
|
||||
|
||||
function! Test_Use_Mappings_HUMAN_ForceMenu()
|
||||
call ThisTestIsFlaky()
|
||||
lcd testdata/cpp/simple
|
||||
edit simple.cpp
|
||||
call setpos( '.', [ 0, 15, 1 ] )
|
||||
|
||||
" Comma is the leader
|
||||
py3 <<EOF
|
||||
from unittest import mock
|
||||
with mock.patch( 'vimspector.utils.SelectFromList', return_value=1 ) as sfl:
|
||||
vim.eval( 'feedkeys( ",\<F5>", "xt" )' )
|
||||
sfl.assert_called()
|
||||
EOF
|
||||
|
||||
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 15, 1 )
|
||||
|
||||
call vimspector#test#setup#Reset()
|
||||
|
||||
lcd -
|
||||
%bwipeout!
|
||||
endfunction
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue