Skip to content

Commit 3321e47

Browse files
authored
Merge pull request #764 from puremourning/fix-breakpoinhts-display-after-stop
Fix showing breakpoints when connection closed
2 parents f0d9b64 + 6882a2b commit 3321e47

File tree

3 files changed

+48
-5
lines changed

3 files changed

+48
-5
lines changed

python3/vimspector/breakpoints.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,11 @@ def ConnectionClosed( self, connection: DebugAdapterConnection ):
276276
self._awaiting_bp_responses = 0
277277
self._pending_send_breakpoints = []
278278

279-
# NOTE: we don't reset self._exception_breakpoints because we don't want to
280-
# re-ask the user every time for the sane info.
281-
282-
# FIXME: If the adapter type changes, we should probably forget this ?
279+
# Ensure that we now display verified/etc. breakpoints correctly (we might
280+
# have closed the connection that verified a given BP). If this was the last
281+
# connection closing, then we need to re-post all the breakpoints as "user"
282+
# breakpoints (as opposed to server ones). All this is done by UpdateUI()
283+
self.UpdateUI()
283284

284285

285286
def ToggleBreakpointsView( self ):

python3/vimspector/debug_session.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2037,7 +2037,6 @@ def OnServerExit( self, status ):
20372037
self._disassemblyView.ConnectionClosed( self._connection )
20382038

20392039
self.Clear()
2040-
20412040
self._ResetServerState()
20422041

20432042
if self._run_on_server_exit:

tests/breakpoints.test.vim

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1508,3 +1508,46 @@ function! Test_LineBreakpoint_Moved_By_Server()
15081508
call vimspector#test#setup#Reset()
15091509
%bwipe!
15101510
endfunction
1511+
1512+
function! Test_ShowBreakpointsAfterStop()
1513+
let fn = '../support/test/python/simple_python/main.py'
1514+
exe 'edit' fn
1515+
call vimspector#SetLineBreakpoint( fn, 23 )
1516+
call vimspector#test#signs#AssertSignGroupSingletonAtLine(
1517+
\ 'VimspectorBP',
1518+
\ 23,
1519+
\ 'vimspectorBP',
1520+
\ 9 )
1521+
call vimspector#LaunchWithSettings( { 'configuration': 'run' } )
1522+
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 23, 1 )
1523+
call vimspector#test#signs#AssertSignGroupSingletonAtLine(
1524+
\ 'VimspectorCode',
1525+
\ 23,
1526+
\ 'vimspectorPCBP',
1527+
\ 200 )
1528+
1529+
call vimspector#ListBreakpoints()
1530+
call s:CheckBreakpointView( [
1531+
\ 'main.py:23 Line breakpoint - VERIFIED: {}'
1532+
\ ] )
1533+
wincmd p
1534+
call vimspector#ListBreakpoints()
1535+
1536+
call vimspector#Stop()
1537+
call WaitForAssert( { ->
1538+
\ vimspector#test#signs#AssertSignGroupSingletonAtLine(
1539+
\ 'VimspectorBP',
1540+
\ 23,
1541+
\ 'vimspectorBP',
1542+
\ 9 ) } )
1543+
1544+
call vimspector#ListBreakpoints()
1545+
call s:CheckBreakpointView( [
1546+
\ 'main.py:23 Line breakpoint - ENABLED: {}'
1547+
\ ] )
1548+
wincmd p
1549+
call vimspector#ListBreakpoints()
1550+
1551+
call vimspector#test#setup#Reset()
1552+
%bwipeout!
1553+
endfunction

0 commit comments

Comments
 (0)