Allow forcing selection from the menu with <leader>F5

This commit is contained in:
Ben Jackson 2021-03-05 21:09:39 +00:00
commit 7723d58cf8
3 changed files with 11 additions and 3 deletions

View file

@ -99,7 +99,7 @@ class DebugSession( object ):
return launch_config_file, configurations
def Start( self, launch_variables = None ):
def Start( self, force_choose=False, launch_variables = None ):
# We mutate launch_variables, so don't mutate the default argument.
# https://docs.python-guide.org/writing/gotchas/#mutable-default-arguments
if launch_variables is None:
@ -134,6 +134,11 @@ class DebugSession( object ):
if 'configuration' in launch_variables:
configuration_name = launch_variables.pop( 'configuration' )
elif force_choose:
# Always display the menu
configuration_name = utils.SelectFromList(
'Which launch configuration?',
sorted( configurations.keys() ) )
elif ( len( configurations ) == 1 and
next( iter( configurations.values() ) ).get( "autoselect", True ) ):
configuration_name = next( iter( configurations.keys() ) )