fixing linting errors in python files

This commit is contained in:
dsych 2021-01-03 00:42:06 -05:00 • committed by Ben Jackson
commit e0b1d6ed81
3 changed files with 57 additions and 29 deletions

View file

@ -640,7 +640,11 @@ def DisplayBaloon( is_term, display, is_hover = False ):
# Refer https://github.com/vim/vim/issues/1512#issuecomment-492070685 # Refer https://github.com/vim/vim/issues/1512#issuecomment-492070685
display = '\n'.join( display ) display = '\n'.join( display )
rc = int( vim.eval( "vimspector#internal#balloon#CreateTooltip({}, {})".format(is_hover, json.dumps( display )) ) ) rc = int( vim.eval(
"vimspector#internal#balloon#CreateTooltip({}, {})".format(
is_hover, json.dumps( display )
)
) )
vim.eval( "vimspector#internal#balloon#nvim_resize_tooltip()" ) vim.eval( "vimspector#internal#balloon#nvim_resize_tooltip()" )

View file

@ -138,8 +138,8 @@ class VariablesView( object ):
self._connection = None self._connection = None
self._current_syntax = '' self._current_syntax = ''
self._variable_eval = None self._variable_eval: Scope = None
self._variable_eval_view = None self._variable_eval_view: View = None
def AddExpandMappings(): def AddExpandMappings():
vim.command( 'nnoremap <silent> <buffer> <CR> ' vim.command( 'nnoremap <silent> <buffer> <CR> '
@ -186,7 +186,9 @@ class VariablesView( object ):
'balloonexpr': vim.options[ 'balloonexpr' ], 'balloonexpr': vim.options[ 'balloonexpr' ],
'balloondelay': vim.options[ 'balloondelay' ], 'balloondelay': vim.options[ 'balloondelay' ],
} }
vim.options[ 'balloonexpr' ] = 'vimspector#internal#balloon#HoverTooltip()' vim.options[ 'balloonexpr' ] = "vimspector#internal#"
"balloon#HoverTooltip()"
vim.options[ 'balloondelay' ] = 250 vim.options[ 'balloondelay' ] = 250
if has_balloon: if has_balloon:
@ -274,15 +276,25 @@ class VariablesView( object ):
with utils.RestoreCursorPosition(): with utils.RestoreCursorPosition():
with utils.ModifiableScratchBuffer( self._variable_eval_view.buf ): with utils.ModifiableScratchBuffer( self._variable_eval_view.buf ):
utils.ClearBuffer( self._variable_eval_view.buf ) utils.ClearBuffer( self._variable_eval_view.buf )
# if we only have a single non-expandable variable, it means we ran into a simple type # if we only have a single non-expandable variable,
# it means we ran into a simple type
# hence, there is no need to draw additional fluff around the value # hence, there is no need to draw additional fluff around the value
if(len(self._variable_eval.variables) == 1 and self._variable_eval.variables[0].IsExpandable() == False): if(
len( self._variable_eval.variables ) == 1
and self._variable_eval.variables[ 0 ].IsExpandable() is False
):
utils.AppendToBuffer( utils.AppendToBuffer(
self._variable_eval_view.buf, self._variable_eval_view.buf,
self._variable_eval.variables[0].variable.get( 'value', '<unknown>' ) self._variable_eval.variables[ 0 ]
.variable.get( 'value', '<unknown>' )
) )
else: else:
self._DrawVariables( self._variable_eval_view, self._variable_eval.variables, 2 , True) self._DrawVariables(
self._variable_eval_view,
self._variable_eval.variables,
2,
True
)
vim.eval( "vimspector#internal#balloon#nvim_resize_tooltip()" ) vim.eval( "vimspector#internal#balloon#nvim_resize_tooltip()" )
@ -306,7 +318,15 @@ class VariablesView( object ):
# since vim's popup cant be focused there is no way # since vim's popup cant be focused there is no way
# to get a reference to its window # to get a reference to its window
# we will emulate python's window object ourselves # we will emulate python's window object ourselves
self._variable_eval_view = View(type('__vim__window__', (object,), {'options': {}, 'buffer': vim.buffers[float_buf_nr]}), {}, self._DrawEval) self._variable_eval_view = View(
type(
'__vim__window__',
( object, ),
{ 'options': {}, 'buffer': vim.buffers[ float_buf_nr ] }
),
{},
self._DrawEval
)
if( self._variable_eval.VariablesReference() > 0 ): if( self._variable_eval.VariablesReference() > 0 ):
self._connection.DoRequest( partial( self._ConsumeVariables, self._connection.DoRequest( partial( self._ConsumeVariables,
@ -318,9 +338,12 @@ class VariablesView( object ):
}, },
} ) } )
else: else:
# in case that there is nothing to expand, we need to simulate a response from 'variables' request # in case that there is nothing to expand,
# we need to simulate a response from 'variables' request
# it returns [Variable] # it returns [Variable]
self._variable_eval.variables = [Variable({ 'type': body['type'], 'value': body['result']})] self._variable_eval.variables = [
Variable( { 'type': body[ 'type' ], 'value': body[ 'result' ] } )
]
self._DrawEval() self._DrawEval()
@ -474,7 +497,8 @@ class VariablesView( object ):
line = utils.AppendToBuffer( line = utils.AppendToBuffer(
view.buf, view.buf,
text.split( '\n' )) text.split( '\n' )
)
view.lines[ line ] = variable view.lines[ line ] = variable