Skip to content

Commit f01a51e

Browse files
committed
Merge pull request #128 from tommcdo/breakpoint-complete
Add completion to :Breakpoint command
2 parents 32672ab + e9ea8c0 commit f01a51e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

plugin/vdebug.vim

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ exe "noremap ".g:vdebug_keymap["set_breakpoint"]." :python debugger.set_breakpoi
118118
exe "vnoremap ".g:vdebug_keymap["eval_visual"]." :python debugger.handle_visual_eval()<cr>"
119119

120120
" Commands
121-
command! -nargs=? Breakpoint python debugger.set_breakpoint(<q-args>)
121+
command! -nargs=? -complete=customlist,s:BreakpointTypes Breakpoint python debugger.set_breakpoint(<q-args>)
122122
command! -nargs=? BreakpointRemove python debugger.remove_breakpoint(<q-args>)
123123
command! BreakpointWindow python debugger.toggle_breakpoint_window()
124124
command! -nargs=? VdebugEval python debugger.handle_eval(<q-args>)
@@ -132,6 +132,16 @@ hi default DbgCurrentSign term=reverse ctermfg=White ctermbg=Red guifg=#ffffff g
132132
hi default DbgBreakptLine term=reverse ctermfg=White ctermbg=Green guifg=#ffffff guibg=#00ff00
133133
hi default DbgBreakptSign term=reverse ctermfg=White ctermbg=Green guifg=#ffffff guibg=#00ff00
134134

135+
function! s:BreakpointTypes(A,L,P)
136+
let arg_to_cursor = strpart(a:L,11,a:P)
137+
let space_idx = stridx(arg_to_cursor,' ')
138+
if space_idx == -1
139+
return filter(['conditional ','exception ','return ','call ','watch '],'v:val =~ "^".a:A.".*"')
140+
else
141+
return []
142+
endif
143+
endfunction
144+
135145
function! s:OptionNames(A,L,P)
136146
let arg_to_cursor = strpart(a:L,10,a:P)
137147
let space_idx = stridx(arg_to_cursor,' ')

0 commit comments

Comments
 (0)