diff --git a/autoload/vebugger/ninspect.vim b/autoload/vebugger/ninspect.vim index 38cc453..49ce29b 100644 --- a/autoload/vebugger/ninspect.vim +++ b/autoload/vebugger/ninspect.vim @@ -1,8 +1,8 @@ -function! vebugger#ninspect#start(entryFile,args) +function! vebugger#ninspect#attach(connection, args) let l:debugger=vebugger#std#startDebugger(shellescape(vebugger#util#getToolFullPath('node',get(a:args,'version'),'node')) - \.' inspect '.a:entryFile.' '.vebugger#util#commandLineArgsForProgram(a:args)) + \.' inspect '.a:connection) let l:debugger.state.ninspect={} - let l:debugger.state.std.config.externalFileStop_flowCommand='stepover' "skip external modules + "let l:debugger.state.std.config.externalFileStop_flowCommand='stepover' "skip external modules call l:debugger.writeLine("$stdout=$stderr") @@ -20,7 +20,43 @@ function! vebugger#ninspect#start(entryFile,args) call l:debugger.setWriteHandler('std','breakpoints',function('vebugger#ninspect#_writeBreakpoints')) call l:debugger.setWriteHandler('std','evaluateExpressions',function('vebugger#ninspect#_requestEvaluateExpression')) " call l:debugger.setWriteHandler('std','executeStatements',function('vebugger#ninspect#_executeStatements')) - call l:debugger.setWriteHandler('std','removeAfterDisplayed',function('vebugger#ninspect#_removeAfterDisplayed')) + " call l:debugger.setWriteHandler('std','removeAfterDisplayed',function('vebugger#ninspect#_removeAfterDisplayed')) + + call l:debugger.setWriteHandler('std','closeDebugger',function('vebugger#ninspect#_closeDebugger')) + + call l:debugger.generateWriteActionsFromTemplate() + + call l:debugger.std_addAllBreakpointActions(g:vebugger_breakpoints) + + " Don't stop at the beginning + " call l:debugger.writeLine('cont') + + return l:debugger +endfunction + +function! vebugger#ninspect#start(entryFile,args) + let l:debugger=vebugger#std#startDebugger(shellescape(vebugger#util#getToolFullPath('node',get(a:args,'version'),'node')) + \.' inspect '.a:entryFile.' '.vebugger#util#commandLineArgsForProgram(a:args)) + let l:debugger.state.ninspect={} + "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" + if !has('win32') + call vebugger#std#openShellBuffer(l:debugger) + endif + + call l:debugger.addReadHandler(function('vebugger#ninspect#_readProgramOutput')) + call l:debugger.addReadHandler(function('vebugger#ninspect#_readWhere')) + " call l:debugger.addReadHandler(function('vebugger#ninspect#_readEvaluatedExpressions')) + call l:debugger.addReadHandler(function('vebugger#ninspect#_readFinish')) + + call l:debugger.setWriteHandler('std','flow',function('vebugger#ninspect#_writeFlow')) + call l:debugger.setWriteHandler('std','breakpoints',function('vebugger#ninspect#_writeBreakpoints')) + call l:debugger.setWriteHandler('std','evaluateExpressions',function('vebugger#ninspect#_requestEvaluateExpression')) + " call l:debugger.setWriteHandler('std','executeStatements',function('vebugger#ninspect#_executeStatements')) + " call l:debugger.setWriteHandler('std','removeAfterDisplayed',function('vebugger#ninspect#_removeAfterDisplayed')) call l:debugger.setWriteHandler('std','closeDebugger',function('vebugger#ninspect#_closeDebugger')) @@ -38,16 +74,36 @@ function! vebugger#ninspect#_readProgramOutput(pipeName,line,readResult,debugger if 'err'==a:pipeName let a:readResult.std.programOutput={'line':a:line} else - let l:matches=matchlist(a:line,'\v(^........debug\>.............|^........|^)\<\s(.*)$') - if 3.............\<\sWaiting\sfor\sthe\sdebugger\sto\sdisconnect...') + "if 1.............|^........|^)\<\s(.*)$') + if 3') + " if 1