Added write actions
Also added flow commands
This commit is contained in:
parent
9788f69c3e
commit
048e4a089a
@ -64,6 +64,24 @@ function! s:f_debugger.handleLine(pipeName,line) dict
|
||||
for l:thinkHandler in self.thinkHandlers
|
||||
call l:thinkHandler.handle(l:readResult,self)
|
||||
endfor
|
||||
|
||||
call self.performWriteActions()
|
||||
endfunction
|
||||
|
||||
function! s:f_debugger.performWriteActions() dict
|
||||
for l:namespace in keys(self.writeActions)
|
||||
let l:handlers=get(self.writeHandlers,l:namespace)
|
||||
if !empty(l:handlers)
|
||||
for l:writeAction in items(self.writeActions[l:namespace])
|
||||
if !empty(l:writeAction[1])
|
||||
if has_key(l:handlers,l:writeAction[0])
|
||||
call l:handlers[l:writeAction[0]].handle(l:writeAction[1],self)
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
endfor
|
||||
call self.generateWriteActionsFromTemplate()
|
||||
endfunction
|
||||
|
||||
function! s:f_debugger.showLogBuffer() dict
|
||||
@ -115,6 +133,17 @@ function! s:addHandler(list,handler)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:setHandler(dict,namespace,name,handler)
|
||||
if !has_key(a:dict,a:namespace)
|
||||
let a:dict[a:namespace]={}
|
||||
endif
|
||||
if type(a:handler) == type({})
|
||||
let a:dict[a:namespace][a:name]=a:handler
|
||||
elseif type(a:handler) == type(function('tr'))
|
||||
let a:dict[a:namespace][a:name]={'handle':a:handler}
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:f_debugger.addReadHandler(handler) dict
|
||||
call s:addHandler(self.readHandlers,a:handler)
|
||||
endfunction
|
||||
@ -123,10 +152,22 @@ function! s:f_debugger.addThinkHandler(handler) dict
|
||||
call s:addHandler(self.thinkHandlers,a:handler)
|
||||
endfunction
|
||||
|
||||
function! s:f_debugger.setWriteHandler(namespace,name,handler) dict
|
||||
call s:setHandler(self.writeHandlers,a:namespace,a:name,a:handler)
|
||||
endfunction
|
||||
|
||||
function! s:f_debugger.addCloseHandler(handler) dict
|
||||
call s:addHandler(self.closeHandlers,a:handler)
|
||||
endfunction
|
||||
|
||||
function! s:f_debugger.generateWriteActionsFromTemplate() dict
|
||||
let self.writeActions=deepcopy(self.writeActionsTemplate)
|
||||
endfunction
|
||||
|
||||
function! s:f_debugger.setWriteAction(namespace,name,value) dict
|
||||
let self.writeActions[a:namespace][a:name]=a:value
|
||||
endfunction
|
||||
|
||||
function! vebugger#createDebugger(command)
|
||||
|
||||
let l:debugger=deepcopy(s:f_debugger)
|
||||
@ -141,6 +182,7 @@ function! vebugger#createDebugger(command)
|
||||
|
||||
let l:debugger.readResultTemplate={}
|
||||
let l:debugger.state={}
|
||||
let l:debugger.writeActionsTemplate={}
|
||||
|
||||
let l:debugger.readHandlers=[]
|
||||
let l:debugger.thinkHandlers=[]
|
||||
@ -200,3 +242,20 @@ endfunction
|
||||
function! vebugger#getActiveDebugger()
|
||||
return s:debugger
|
||||
endfunction
|
||||
|
||||
function! vebugger#setWriteAction(namespace,name,value)
|
||||
if exists('s:debugger')
|
||||
call s:debugger.setWriteAction(a:namespace,a:name,a:value)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! vebugger#performWriteActions()
|
||||
if exists('s:debugger')
|
||||
call s:debugger.performWriteActions()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! vebugger#setWriteActionAndPerform(namespace,name,value)
|
||||
call vebugger#setWriteAction(a:namespace,a:name,a:value)
|
||||
call vebugger#performWriteActions()
|
||||
endfunction
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
function! vebugger#jdb#start(entryClass,args)
|
||||
let l:debugger=vebugger#std#startDebugger('jdb'.(
|
||||
\has_key(a:args,'classpath')
|
||||
@ -13,6 +12,10 @@ function! vebugger#jdb#start(entryClass,args)
|
||||
|
||||
call l:debugger.addReadHandler(function('s:readWhere'))
|
||||
|
||||
call l:debugger.setWriteHandler('std','flow',function('s:writeFlow'))
|
||||
|
||||
call l:debugger.generateWriteActionsFromTemplate()
|
||||
|
||||
return l:debugger
|
||||
endfunction
|
||||
|
||||
@ -46,5 +49,17 @@ function! s:readWhere(pipeName,line,readResult,debugger)
|
||||
\'file':(l:file),
|
||||
\'line':(l:matches[4])}
|
||||
endif
|
||||
end
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:writeFlow(writeAction,debugger)
|
||||
if 'stepin'==a:writeAction
|
||||
call a:debugger.writeLine('step')
|
||||
elseif 'stepover'==a:writeAction
|
||||
call a:debugger.writeLine('next')
|
||||
elseif 'stepout'==a:writeAction
|
||||
call a:debugger.writeLine('step up')
|
||||
elseif 'continue'==a:writeAction
|
||||
call a:debugger.writeLine('cont')
|
||||
endif
|
||||
endfunction
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
function! vebugger#std#setStandardState(debugger)
|
||||
let a:debugger.state.std={
|
||||
\'srcpath':'.',
|
||||
@ -12,6 +11,11 @@ function! vebugger#std#setStandardReadResultTemplate(debugger)
|
||||
\'callstack':{}}
|
||||
endfunction
|
||||
|
||||
function! vebugger#std#setStandardWriteactionsTemplate(debugger)
|
||||
let a:debugger.writeActionsTemplate.std={
|
||||
\'flow':''}
|
||||
endfunction
|
||||
|
||||
function! vebugger#std#addStandardFunctions(debugger)
|
||||
for l:k in keys(s:standardFunctions)
|
||||
let a:debugger['std_'.l:k]=s:standardFunctions[l:k]
|
||||
@ -33,6 +37,7 @@ endfunction
|
||||
function! vebugger#std#standardInit(debugger)
|
||||
call vebugger#std#setStandardState(a:debugger)
|
||||
call vebugger#std#setStandardReadResultTemplate(a:debugger)
|
||||
call vebugger#std#setStandardWriteactionsTemplate(a:debugger)
|
||||
call vebugger#std#addStandardFunctions(a:debugger)
|
||||
call vebugger#std#addStandardThinkHandlers(a:debugger)
|
||||
call vebugger#std#addStandardCloseHandlers(a:debugger)
|
||||
|
@ -1,3 +1,8 @@
|
||||
|
||||
|
||||
command! -nargs=1 VBGwrite call vebugger#writeLine(<q-args>)
|
||||
command! -nargs=1 VBGrawWrite call vebugger#writeLine(<q-args>)
|
||||
|
||||
command! -nargs=0 VBGstepIn call vebugger#setWriteActionAndPerform('std','flow','stepin')
|
||||
command! -nargs=0 VBGstepOver call vebugger#setWriteActionAndPerform('std','flow','stepover')
|
||||
command! -nargs=0 VBGstepOut call vebugger#setWriteActionAndPerform('std','flow','stepout')
|
||||
command! -nargs=0 VBGcontinue call vebugger#setWriteActionAndPerform('std','flow','continue')
|
||||
|
Loading…
Reference in New Issue
Block a user