From b95fe208456d0d206af379bb8bf1e4362600576f Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Thu, 31 Oct 2019 10:18:23 +0000 Subject: [PATCH] Frame is not reqiured for evaluation --- python3/vimspector/output.py | 14 +++++++------- python3/vimspector/variables.py | 10 +++++++--- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/python3/vimspector/output.py b/python3/vimspector/output.py index be722af..d4cf1af 100644 --- a/python3/vimspector/output.py +++ b/python3/vimspector/output.py @@ -115,10 +115,6 @@ class OutputView( object ): 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 ) @@ -132,14 +128,18 @@ class OutputView( object ): 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: diff --git a/python3/vimspector/variables.py b/python3/vimspector/variables.py index 7260a43..f0ff99e 100644 --- a/python3/vimspector/variables.py +++ b/python3/vimspector/variables.py @@ -143,10 +143,12 @@ class VariablesView( object ): 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() @@ -395,3 +397,5 @@ class VariablesView( object ): with utils.LetCurrentWindow( self._watch.win ): vim.command( 'set syntax={}'.format( utils.Escape( syntax ) ) ) + +# vim: sw=2