Start to add a test, but it's hitting deleting buffer that's in use [NULL]...
This commit is contained in:
parent
f003d66d35
commit
e7fb49f03d
5 changed files with 71 additions and 17 deletions
|
|
@ -47,6 +47,16 @@ function! vimspector#internal#state#GetAPIPrefix() abort
|
||||||
return s:prefix
|
return s:prefix
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! vimspector#internal#state#TabClosed() abort
|
||||||
|
py3 << EOF
|
||||||
|
|
||||||
|
if ( '_vimspector_session' in globals() and _vimspector_session
|
||||||
|
and not _vimspector_session._HasUI() ):
|
||||||
|
_vimspector_session.Reset( interactive = False )
|
||||||
|
|
||||||
|
EOF
|
||||||
|
endfunction
|
||||||
|
|
||||||
" Boilerplate {{{
|
" Boilerplate {{{
|
||||||
let &cpoptions=s:save_cpo
|
let &cpoptions=s:save_cpo
|
||||||
unlet s:save_cpo
|
unlet s:save_cpo
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,9 @@ if ! has( 'gui_running' )
|
||||||
" å is the right-option+q
|
" å is the right-option+q
|
||||||
nnoremap <buffer> å :cfirst<CR>
|
nnoremap <buffer> å :cfirst<CR>
|
||||||
" å is the right-option+a
|
" å is the right-option+a
|
||||||
nnoremap <buffer> œ :FuncLine<CR>
|
nnoremap <buffer> œ :cnext<CR>
|
||||||
|
" å is the right-option+f
|
||||||
|
nnoremap <buffer> ƒ :FuncLine<CR>
|
||||||
" Ω is the right-option+z
|
" Ω is the right-option+z
|
||||||
nnoremap <buffer> Ω :cprevious<CR>
|
nnoremap <buffer> Ω :cprevious<CR>
|
||||||
endif
|
endif
|
||||||
|
|
|
||||||
|
|
@ -145,9 +145,14 @@ augroup VimspectorUserAutoCmds
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
" FIXME: Only register this _while_ debugging is active
|
" FIXME: Only register this _while_ debugging is active
|
||||||
|
let g:vimspector_resetting = 0
|
||||||
augroup Vimspector
|
augroup Vimspector
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd BufNew * call vimspector#OnBufferCreated( expand( '<afile>' ) )
|
autocmd BufNew * call vimspector#OnBufferCreated( expand( '<afile>' ) )
|
||||||
|
autocmd TabClosed *
|
||||||
|
\ if !g:vimspector_resetting
|
||||||
|
\ | call vimspector#internal#state#TabClosed()
|
||||||
|
\ | endif
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
" boilerplate {{{
|
" boilerplate {{{
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,7 @@ class DebugSession( object ):
|
||||||
self._stackTraceView = None
|
self._stackTraceView = None
|
||||||
self._variablesView = None
|
self._variablesView = None
|
||||||
self._outputView = None
|
self._outputView = None
|
||||||
|
self._codeView = None
|
||||||
self._breakpoints = breakpoints.ProjectBreakpoints()
|
self._breakpoints = breakpoints.ProjectBreakpoints()
|
||||||
self._splash_screen = None
|
self._splash_screen = None
|
||||||
self._remote_term = None
|
self._remote_term = None
|
||||||
|
|
@ -404,27 +405,43 @@ class DebugSession( object ):
|
||||||
self._Reset()
|
self._Reset()
|
||||||
|
|
||||||
def _Reset( self ):
|
def _Reset( self ):
|
||||||
|
vim.vars[ 'vimspector_resetting' ] = 1
|
||||||
self._logger.info( "Debugging complete." )
|
self._logger.info( "Debugging complete." )
|
||||||
|
|
||||||
|
def ResetUI():
|
||||||
|
if self._stackTraceView:
|
||||||
|
self._stackTraceView.Reset()
|
||||||
|
if self._variablesView:
|
||||||
|
self._variablesView.Reset()
|
||||||
|
if self._outputView:
|
||||||
|
self._outputView.Reset()
|
||||||
|
if self._codeView:
|
||||||
|
self._codeView.Reset()
|
||||||
|
|
||||||
|
self._stackTraceView = None
|
||||||
|
self._variablesView = None
|
||||||
|
self._outputView = None
|
||||||
|
self._codeView = None
|
||||||
|
self._remote_term = None
|
||||||
|
self._uiTab = None
|
||||||
|
|
||||||
if self._HasUI():
|
if self._HasUI():
|
||||||
self._logger.debug( "Clearing down UI" )
|
self._logger.debug( "Clearing down UI" )
|
||||||
vim.current.tabpage = self._uiTab
|
vim.current.tabpage = self._uiTab
|
||||||
self._splash_screen = utils.HideSplash( self._api_prefix,
|
self._splash_screen = utils.HideSplash( self._api_prefix,
|
||||||
self._splash_screen )
|
self._splash_screen )
|
||||||
self._stackTraceView.Reset()
|
ResetUI()
|
||||||
self._variablesView.Reset()
|
|
||||||
self._outputView.Reset()
|
|
||||||
self._codeView.Reset()
|
|
||||||
vim.command( 'au! VimspectorReset TabClose <buffer>' )
|
|
||||||
vim.command( 'tabclose!' )
|
vim.command( 'tabclose!' )
|
||||||
|
else:
|
||||||
|
ResetUI()
|
||||||
|
|
||||||
|
try:
|
||||||
|
del vim.vars[ 'vimspector_session_windows' ]
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
del vim.vars[ 'vimspector_session_windows' ]
|
|
||||||
vim.command( 'doautocmd <nomodeline> User VimspectorDebugEnded' )
|
vim.command( 'doautocmd <nomodeline> User VimspectorDebugEnded' )
|
||||||
self._stackTraceView = None
|
vim.vars[ 'vimspector_resetting' ] = 0
|
||||||
self._variablesView = None
|
|
||||||
self._outputView = None
|
|
||||||
self._codeView = None
|
|
||||||
self._remote_term = None
|
|
||||||
self._uiTab = None
|
|
||||||
|
|
||||||
# make sure that we're displaying signs in any still-open buffers
|
# make sure that we're displaying signs in any still-open buffers
|
||||||
self._breakpoints.UpdateUI()
|
self._breakpoints.UpdateUI()
|
||||||
|
|
@ -667,10 +684,6 @@ class DebugSession( object ):
|
||||||
def _SetUpUI( self ):
|
def _SetUpUI( self ):
|
||||||
vim.command( 'tab split' )
|
vim.command( 'tab split' )
|
||||||
self._uiTab = vim.current.tabpage
|
self._uiTab = vim.current.tabpage
|
||||||
vim.command( 'augroup VimspectorReset' )
|
|
||||||
vim.command( 'au TabClosed <buffer> call vimspector#Reset()' )
|
|
||||||
vim.command( 'augroup END' )
|
|
||||||
|
|
||||||
|
|
||||||
mode = settings.Get( 'ui_mode' )
|
mode = settings.Get( 'ui_mode' )
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,17 @@ function! ClearDown()
|
||||||
call vimspector#test#setup#ClearDown()
|
call vimspector#test#setup#ClearDown()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
let s:fn='../support/test/python/simple_python/main.py'
|
||||||
|
|
||||||
|
function! s:StartDebugging()
|
||||||
|
exe 'edit ' . s:fn
|
||||||
|
call setpos( '.', [ 0, 23, 1 ] )
|
||||||
|
call vimspector#ToggleBreakpoint()
|
||||||
|
call vimspector#LaunchWithSettings( { 'configuration': 'run' } )
|
||||||
|
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( s:fn, 23, 1 )
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! Test_Step_With_Different_Tabpage()
|
function! Test_Step_With_Different_Tabpage()
|
||||||
lcd testdata/cpp/simple
|
lcd testdata/cpp/simple
|
||||||
edit simple.cpp
|
edit simple.cpp
|
||||||
|
|
@ -154,3 +165,16 @@ function! Test_All_Buffers_Deleted_Installer()
|
||||||
au! Test_All_Buffers_Deleted_Installer
|
au! Test_All_Buffers_Deleted_Installer
|
||||||
%bwipe!
|
%bwipe!
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! Test_Close_Tab_No_Vimspector()
|
||||||
|
tabnew
|
||||||
|
q
|
||||||
|
%bwipe!
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! Test_Close_Tab_With_Vimspector()
|
||||||
|
call s:StartDebugging()
|
||||||
|
tabclose!
|
||||||
|
call vimspector#test#setup#WaitForReset()
|
||||||
|
%bwipe!
|
||||||
|
endfunction
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue