Merge pull request #80 from tinmarino/merge_ballon

Fix: Remove balloon '...' in windows != code_window
This commit is contained in:
mergify[bot] 2020-01-10 07:41:22 +00:00 committed by GitHub
commit bda1bb05fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 11 deletions

View file

@ -19,13 +19,14 @@ let s:save_cpo = &cpoptions
set cpoptions&vim
" }}}
" Returns: py.ShowBalloon( winnr, expresssion )
function! vimspector#internal#balloon#BalloonExpr() abort
" winnr + 1 because for *no good reason* winnr is 0 based here unlike
" everywhere else
" int() because for *no good reason* winnr is a string.
py3 _vimspector_session.ShowBalloon( int( vim.eval( 'v:beval_winnr' ) ) + 1,
\ vim.eval( 'v:beval_text' ) )
return '...'
return py3eval('_vimspector_session.ShowBalloon('
\ . 'int( vim.eval( "v:beval_winnr" ) ) + 1,'
\ . 'vim.eval( "v:beval_text" ) )' )
endfunction
" Boilerplate {{{

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: