Skip to content

Commit

Permalink
Frame is not reqiured for evaluation
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Jackson committed Jan 10, 2020
1 parent 8d7de71 commit b95fe20
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
14 changes: 7 additions & 7 deletions python3/vimspector/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,6 @@ def ShowOutput( self, category ):
self._ShowOutput( category )

def Evaluate( self, frame, expression ):
if not frame:
self.Print( 'Console', 'There is no current stack frame' )
return

console = self._buffers[ 'Console' ].buf
utils.AppendToBuffer( console, 'Evaluating: ' + expression )

Expand All @@ -132,14 +128,18 @@ def print_result( message ):

utils.AppendToBuffer( console, ' Result: ' + result )

self._connection.DoRequest( print_result, {
request = {
'command': 'evaluate',
'arguments': {
'expression': expression,
'context': 'repl',
'frameId': frame[ 'id' ],
}
} )
}

if frame:
request[ 'arguments' ][ 'frameId' ] = frame[ 'id' ]

self._connection.DoRequest( print_result, request )

def _ToggleFlag( self, category, flag ):
if self._buffers[ category ].flag != flag:
Expand Down
10 changes: 7 additions & 3 deletions python3/vimspector/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,12 @@ def scopes_consumer( message ):

def AddWatch( self, frame, expression ):
watch = {
'expression': expression,
'frameId': frame[ 'id' ],
'context': 'watch',
'expression': expression,
'context': 'watch',
}
if frame:
watch[ 'frameId' ] = frame[ 'id' ]

self._watches.append( watch )
self.EvaluateWatches()

Expand Down Expand Up @@ -395,3 +397,5 @@ def SetSyntax( self, syntax ):

with utils.LetCurrentWindow( self._watch.win ):
vim.command( 'set syntax={}'.format( utils.Escape( syntax ) ) )

# vim: sw=2

0 comments on commit b95fe20

Please sign in to comment.