Use vim 8 timers for continuous checking of debugger output
This commit is contained in:
parent
fc1f09cd88
commit
e684fdffd9
@ -17,7 +17,9 @@ function! s:f_debugger.kill() dict
|
|||||||
if self.shell.is_valid
|
if self.shell.is_valid
|
||||||
call self.addLineToTerminal('','== DEBUGGER TERMINATED ==')
|
call self.addLineToTerminal('','== DEBUGGER TERMINATED ==')
|
||||||
endif
|
endif
|
||||||
let &updatetime=self.prevUpdateTime
|
if !has('timers')
|
||||||
|
let &updatetime=self.prevUpdateTime
|
||||||
|
endif
|
||||||
call self.shell.kill(15)
|
call self.shell.kill(15)
|
||||||
if exists('s:debugger')
|
if exists('s:debugger')
|
||||||
for l:closeHandler in s:debugger.closeHandlers
|
for l:closeHandler in s:debugger.closeHandlers
|
||||||
@ -54,7 +56,9 @@ function! s:f_debugger.invokeReading() dict
|
|||||||
\|| 'error'==l:checkpid[0]
|
\|| 'error'==l:checkpid[0]
|
||||||
call self.kill()
|
call self.kill()
|
||||||
endif
|
endif
|
||||||
call feedkeys("f\e", '\n') " Make sure the CursorHold event is refired even if the user does nothing
|
if !has('timers')
|
||||||
|
call feedkeys("f\e", '\n') " Make sure the CursorHold event is refired even if the user does nothing
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"Handle a single line from the debugger's interactive shell
|
"Handle a single line from the debugger's interactive shell
|
||||||
@ -262,12 +266,19 @@ function! vebugger#createDebugger(command)
|
|||||||
let l:debugger.writeHandlers={}
|
let l:debugger.writeHandlers={}
|
||||||
let l:debugger.closeHandlers=[]
|
let l:debugger.closeHandlers=[]
|
||||||
|
|
||||||
let l:debugger.prevUpdateTime=&updatetime
|
if !has('timers')
|
||||||
|
let l:debugger.prevUpdateTime=&updatetime
|
||||||
|
set updatetime=500
|
||||||
|
endif
|
||||||
|
|
||||||
set updatetime=500
|
|
||||||
return l:debugger
|
return l:debugger
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
if has('timers')
|
||||||
|
function! s:readingTimerCallback(timerId)
|
||||||
|
call s:debugger.invokeReading()
|
||||||
|
endfunction
|
||||||
|
endif
|
||||||
|
|
||||||
"Create a debugger and set it as the currently active debugger
|
"Create a debugger and set it as the currently active debugger
|
||||||
function! vebugger#startDebugger(command)
|
function! vebugger#startDebugger(command)
|
||||||
@ -275,19 +286,30 @@ function! vebugger#startDebugger(command)
|
|||||||
|
|
||||||
let s:debugger=vebugger#createDebugger(a:command)
|
let s:debugger=vebugger#createDebugger(a:command)
|
||||||
|
|
||||||
augroup vebugger_shell
|
if has('timers')
|
||||||
autocmd!
|
let s:timerId = timer_start(500, function('s:readingTimerCallback'), {'repeat': -1})
|
||||||
autocmd CursorHold * call s:debugger.invokeReading()
|
else
|
||||||
augroup END
|
augroup vebugger_shell
|
||||||
|
autocmd!
|
||||||
|
autocmd CursorHold * call s:debugger.invokeReading()
|
||||||
|
augroup END
|
||||||
|
endif
|
||||||
|
|
||||||
return s:debugger
|
return s:debugger
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"Terminate the currently active debugger
|
"Terminate the currently active debugger
|
||||||
function! vebugger#killDebugger()
|
function! vebugger#killDebugger()
|
||||||
augroup vebugger_shell
|
if has('timers')
|
||||||
autocmd!
|
if exists('s:timerId')
|
||||||
augroup END
|
call timer_stop(s:timerId)
|
||||||
|
unlet s:timerId
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
augroup vebugger_shell
|
||||||
|
autocmd!
|
||||||
|
augroup END
|
||||||
|
endif
|
||||||
if exists('s:debugger')
|
if exists('s:debugger')
|
||||||
call vebugger#std#closeShellBuffer(s:debugger)
|
call vebugger#std#closeShellBuffer(s:debugger)
|
||||||
call s:debugger.closeTerminalBuffer()
|
call s:debugger.closeTerminalBuffer()
|
||||||
|
Loading…
Reference in New Issue
Block a user