Use expression completion for watch and set
This commit is contained in:
parent
94242fa532
commit
f2d407256e
3 changed files with 16 additions and 8 deletions
|
|
@ -235,7 +235,9 @@ function! vimspector#AddWatch( ... ) abort
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
if a:0 == 0
|
if a:0 == 0
|
||||||
let expr = input( 'Enter watch expression: ' )
|
let expr = input( 'Enter watch expression: ',
|
||||||
|
\ '',
|
||||||
|
\ 'custom,vimspector#CompleteExpr' )
|
||||||
else
|
else
|
||||||
let expr = a:1
|
let expr = a:1
|
||||||
endif
|
endif
|
||||||
|
|
|
||||||
|
|
@ -356,16 +356,21 @@ def SelectFromList( prompt, options ):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def AskForInput( prompt, default_value = None ):
|
def AskForInput( prompt, default_value = None, completion = None ):
|
||||||
if default_value is None:
|
if default_value is None:
|
||||||
default_option = ''
|
default_value = ''
|
||||||
else:
|
|
||||||
default_option = ", '{}'".format( Escape( default_value ) )
|
args = [ prompt, default_value ]
|
||||||
|
|
||||||
|
if completion is not None:
|
||||||
|
if completion == 'expr':
|
||||||
|
args.append( 'custom,vimspector#CompleteExpr' )
|
||||||
|
else:
|
||||||
|
args.append( completion )
|
||||||
|
|
||||||
with InputSave():
|
with InputSave():
|
||||||
try:
|
try:
|
||||||
return vim.eval( "input( '{}' {} )".format( Escape( prompt ),
|
return Call( 'input', *args )
|
||||||
default_option ) )
|
|
||||||
except ( KeyboardInterrupt, vim.error ):
|
except ( KeyboardInterrupt, vim.error ):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -533,7 +533,8 @@ class VariablesView( object ):
|
||||||
return
|
return
|
||||||
|
|
||||||
new_value = utils.AskForInput( 'New Value: ',
|
new_value = utils.AskForInput( 'New Value: ',
|
||||||
variable.variable.get( 'value', '' ) )
|
variable.variable.get( 'value', '' ),
|
||||||
|
completion = 'expr' )
|
||||||
|
|
||||||
if new_value is None:
|
if new_value is None:
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue