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
|
|
@ -356,16 +356,21 @@ def SelectFromList( prompt, options ):
|
|||
return None
|
||||
|
||||
|
||||
def AskForInput( prompt, default_value = None ):
|
||||
def AskForInput( prompt, default_value = None, completion = None ):
|
||||
if default_value is None:
|
||||
default_option = ''
|
||||
else:
|
||||
default_option = ", '{}'".format( Escape( default_value ) )
|
||||
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():
|
||||
try:
|
||||
return vim.eval( "input( '{}' {} )".format( Escape( prompt ),
|
||||
default_option ) )
|
||||
return Call( 'input', *args )
|
||||
except ( KeyboardInterrupt, vim.error ):
|
||||
return None
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue