diff --git a/python3/vimspector/breakpoints.py b/python3/vimspector/breakpoints.py index a24d1dea9..82f4c6f32 100644 --- a/python3/vimspector/breakpoints.py +++ b/python3/vimspector/breakpoints.py @@ -87,6 +87,7 @@ def ListBreakpoints( self ): else: for file_name, breakpoints in self._line_breakpoints.items(): for bp in breakpoints: + self._SignToLine( file_name, bp ) qf.append( { 'filename': file_name, 'lnum': bp[ 'line' ], @@ -113,6 +114,7 @@ def ClearBreakpoints( self ): # These are the user-entered breakpoints. for file_name, breakpoints in self._line_breakpoints.items(): for bp in breakpoints: + self._SignToLine( file_name, bp ) if 'sign_id' in bp: vim.command( 'sign unplace {0} group=VimspectorBP'.format( bp[ 'sign_id' ] ) ) @@ -132,6 +134,7 @@ def ToggleBreakpoint( self ): found_bp = False action = 'New' for index, bp in enumerate( self._line_breakpoints[ file_name ] ): + self._SignToLine( file_name, bp ) if bp[ 'line' ] == line: found_bp = True if bp[ 'state' ] == 'ENABLED' and not self._connection: @@ -143,7 +146,7 @@ def ToggleBreakpoint( self ): bp[ 'sign_id' ] ) ) del self._line_breakpoints[ file_name ][ index ] action = 'Delete' - break + break self._logger.debug( "Toggle found bp at {}:{} ? {} ({})".format( file_name, @@ -215,6 +218,7 @@ def response_handler( source, msg ): for file_name, line_breakpoints in self._line_breakpoints.items(): breakpoints = [] for bp in line_breakpoints: + self._SignToLine( file_name, bp ) if 'sign_id' in bp: vim.command( 'sign unplace {0} group=VimspectorBP'.format( bp[ 'sign_id' ] ) ) @@ -330,6 +334,7 @@ def _SetUpExceptionBreakpoints( self, configured_breakpoints ): def _ShowBreakpoints( self ): for file_name, line_breakpoints in self._line_breakpoints.items(): for bp in line_breakpoints: + self._SignToLine( file_name, bp ) if 'sign_id' in bp: vim.command( 'sign unplace {0} group=VimspectorBP '.format( bp[ 'sign_id' ] ) ) @@ -344,3 +349,17 @@ def _ShowBreakpoints( self ): 'vimspectorBP' if bp[ 'state' ] == 'ENABLED' else 'vimspectorBPDisabled', file_name ) ) + + + def _SignToLine( self, file_name, bp ): + if 'sign_id' not in bp: + return bp[ 'line' ] + + signs = vim.eval( "sign_getplaced( '{}', {} )".format( + utils.Escape( file_name ), + json.dumps( { 'id': file_name, 'group': 'VimspectorBP', } ) ) ) + + if len( signs ) == 1 and len( signs[ 0 ][ 'signs' ] ) == 1: + bp[ 'line' ] = int( signs[ 0 ][ 'signs' ][ 0 ][ 'lnum' ] ) + + return bp[ 'line' ]