Skip to content

Commit

Permalink
Merge pull request #790 from puremourning/fix-variable-expand-after-r…
Browse files Browse the repository at this point in the history
…estart

Fix expanding variables after restart
  • Loading branch information
mergify[bot] authored Aug 18, 2023
2 parents 4bb3510 + 45596f3 commit 4e49a17
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions python3/vimspector/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@ def VariablesReference( self ):
def MemoryReference( self ):
return self.result.get( 'memoryReference' )

def Update( self, result ):
def Update( self, connection, result ):
self.changed = False
self.connection = connection
if self.result[ 'result' ] != result[ 'result' ]:
self.changed = True
self.result = result
Expand Down Expand Up @@ -141,8 +142,9 @@ def VariablesReference( self ):
def MemoryReference( self ):
return self.variable.get( 'memoryReference' )

def Update( self, variable ):
def Update( self, connection, variable ):
self.changed = False
self.connection = connection
if self.variable[ 'value' ] != variable[ 'value' ]:
self.changed = True
self.variable = variable
Expand Down Expand Up @@ -429,7 +431,7 @@ def handler( message ):
if watch.result is None or watch.result.connection != connection:
watch.result = WatchResult( connection, message[ 'body' ] )
else:
watch.result.Update( message[ 'body' ] )
watch.result.Update( connection, message[ 'body' ] )

popup_win_id = utils.CreateTooltip( [], is_hover )
# record the global eval window id
Expand Down Expand Up @@ -534,7 +536,7 @@ def EvaluateWatches( self,

def _UpdateWatchExpression( self, watch: Watch, message: dict ):
if watch.result is not None:
watch.result.Update( message[ 'body' ] )
watch.result.Update( watch.connection, message[ 'body' ] )
else:
watch.result = WatchResult( watch.connection, message[ 'body' ] )

Expand Down Expand Up @@ -648,7 +650,7 @@ def handler( message ):
},
} )

variable.Update( new_variable )
variable.Update( variable.connection, new_variable )
view.draw()

def failure_handler( reason, message ):
Expand Down Expand Up @@ -822,7 +824,7 @@ def _ConsumeVariables( self, draw, parent, message ):
if not found:
variable = Variable( parent.connection, parent, variable_body )
else:
variable.Update( variable_body )
variable.Update( parent.connection, variable_body )

new_variables.append( variable )

Expand Down

0 comments on commit 4e49a17

Please sign in to comment.