Added shell buffer support for rdebug

Also made it skip stops at external files
This commit is contained in:
IdanArye 2014-05-16 18:25:45 +03:00
parent 2d1c16a588
commit f7af3d4406
2 changed files with 21 additions and 0 deletions

View File

@ -5,7 +5,14 @@ function! vebugger#rdebug#start(entryFile,args)
\: 'ruby -rdebug') \: 'ruby -rdebug')
\.' '.a:entryFile) \.' '.a:entryFile)
let l:debugger.state.rdebug={} let l:debugger.state.rdebug={}
let l:debugger.state.std.config.externalFileStop_flowCommand='stepover' "skip external modules
call l:debugger.writeLine("$stdout=$stderr")
let l:debugger.pipes.err.annotation = "err&prg\t\t"
call vebugger#std#openShellBuffer(l:debugger)
call l:debugger.addReadHandler(function('s:readProgramOutput'))
call l:debugger.addReadHandler(function('s:readWhere')) call l:debugger.addReadHandler(function('s:readWhere'))
call l:debugger.addReadHandler(function('s:readEvaluatedExpressions')) call l:debugger.addReadHandler(function('s:readEvaluatedExpressions'))
@ -21,6 +28,12 @@ function! vebugger#rdebug#start(entryFile,args)
return l:debugger return l:debugger
endfunction endfunction
function! s:readProgramOutput(pipeName,line,readResult,debugger)
if 'err'==a:pipeName
let a:readResult.std.programOutput={'line':a:line}
endif
endfunction
function! s:readWhere(pipeName,line,readResult,debugger) function! s:readWhere(pipeName,line,readResult,debugger)
if 'out'==a:pipeName if 'out'==a:pipeName
let l:matches=matchlist(a:line,'\v^([^:]+)\:(\d+)\:(.*)$') let l:matches=matchlist(a:line,'\v^([^:]+)\:(\d+)\:(.*)$')

View File

@ -2,6 +2,8 @@ let g:vebugger_breakpoints=[]
function! vebugger#std#setStandardState(debugger) function! vebugger#std#setStandardState(debugger)
let a:debugger.state.std={ let a:debugger.state.std={
\'config':{
\ 'externalFileStop_flowCommand':''},
\'location':{}, \'location':{},
\'callstack':[], \'callstack':[],
\'evaluateExpressions':[]} \'evaluateExpressions':[]}
@ -127,6 +129,12 @@ endfunction
function! s:standardThinkHandlers.moveToCurrentLine(readResult,debugger) dict function! s:standardThinkHandlers.moveToCurrentLine(readResult,debugger) dict
if !empty(a:readResult.std.location) if !empty(a:readResult.std.location)
if !empty(a:debugger.state.std.config.externalFileStop_flowCommand) " Do we need to worry about stopping at external files?
if 0!=stridx(tolower(fnamemodify(a:readResult.std.location.file,':p')),tolower(getcwd()))
call a:debugger.setWriteAction('std','flow',a:debugger.state.std.config.externalFileStop_flowCommand)
return
endif
endif
if a:debugger.state.std.location!=a:readResult.std.location if a:debugger.state.std.location!=a:readResult.std.location
if has_key(a:debugger.state.std.location,'file') if has_key(a:debugger.state.std.location,'file')
exe 'sign unplace 1 file='.fnameescape(fnamemodify(a:debugger.state.std.location.file,':p')) exe 'sign unplace 1 file='.fnameescape(fnamemodify(a:debugger.state.std.location.file,':p'))