Fix: Remove balloon '...' in windows != code_window

Problem: In non-code window, user see a '...' balloon even if python
knows it does not need to work
Solution: use pyeval in vim so that python's knowledge is getting back
from the stack as return value
This commit is contained in:
tinmarino 2020-01-09 15:35:38 -03:00
commit 1e153910fa
3 changed files with 22 additions and 11 deletions

View file

@ -359,16 +359,22 @@ class DebugSession( object ):
self._variablesView.DeleteWatch()
def ShowBalloon( self, winnr, expression ):
if self._stackTraceView.GetCurrentFrame() is None:
return
"""Proxy: ballonexpr -> variables.ShowBallon"""
frame = self._stackTraceView.GetCurrentFrame()
# Check if RIP is in a frame
if frame is None:
self._logger.debug( 'Balloon: Not in a stack frame' )
return ''
if winnr == int( self._codeView._window.number ):
self._variablesView.ShowBalloon( self._stackTraceView.GetCurrentFrame(),
expression )
else:
# Check if cursor in code window
if winnr != int( self._codeView._window.number ):
self._logger.debug( 'Winnr %s is not the code window %s',
winnr,
self._codeView._window.number )
return ''
# Return variable aware function
return self._variablesView.ShowBalloon( frame, expression )
def ExpandFrameOrThread( self ):
self._stackTraceView.ExpandFrameOrThread()

View file

@ -346,8 +346,9 @@ class VariablesView( object ):
draw()
def ShowBalloon( self, frame, expression ):
"""Callback to display variable under cursor `:h ballonexpr`"""
if not self._connection:
return
return ''
def handler( message ):
# TODO: this result count be expandable, but we have no way to allow the
@ -366,7 +367,7 @@ class VariablesView( object ):
display = [ reason ]
utils.DisplayBaloon( self._is_term, display )
# Send async request
self._connection.DoRequest( handler, {
'command': 'evaluate',
'arguments': {
@ -376,6 +377,9 @@ class VariablesView( object ):
}
}, failure_handler )
# Return working (meanwhile)
return '...'
def SetSyntax( self, syntax ):
if not syntax: