language list

This commit is contained in:
Yatao Li 2020-12-14 21:37:54 +08:00
commit 28c5534704
3 changed files with 46 additions and 33 deletions

View file

@ -114,32 +114,34 @@ parser.add_argument( '--sudo',
done_languages = set()
for name, gadget in gadgets.GADGETS.items():
lang = gadget[ 'language' ]
if lang in done_languages:
continue
langs = gadget[ 'language' ]
if not isinstance(langs, list): langs = [langs]
for lang in langs:
if lang in done_languages:
continue
done_languages.add( lang )
if not gadget.get( 'enabled', True ):
parser.add_argument(
'--force-enable-' + lang,
action = 'store_true',
help = 'Install the unsupported {} debug adapter for {} support'.format(
name,
lang ) )
continue
done_languages.add( lang )
if not gadget.get( 'enabled', True ):
parser.add_argument(
'--force-enable-' + lang,
'--enable-' + lang,
action = 'store_true',
help = 'Install the unsupported {} debug adapter for {} support'.format(
help = 'Install the {} debug adapter for {} support'.format(
name,
lang ) )
continue
parser.add_argument(
'--enable-' + lang,
action = 'store_true',
help = 'Install the {} debug adapter for {} support'.format(
name,
lang ) )
parser.add_argument(
'--disable-' + lang,
action = 'store_true',
help = "Don't install the {} debug adapter for {} support "
'(when supplying --all)'.format( name, lang ) )
parser.add_argument(
'--disable-' + lang,
action = 'store_true',
help = "Don't install the {} debug adapter for {} support "
'(when supplying --all)'.format( name, lang ) )
parser.add_argument(
"--no-check-certificate",
@ -182,15 +184,23 @@ all_adapters = installer.ReadAdapters(
manifest = installer.Manifest()
for name, gadget in gadgets.GADGETS.items():
if not gadget.get( 'enabled', True ):
if ( not args.force_all
and not getattr( args, 'force_enable_' + gadget[ 'language' ] ) ):
continue
else:
if not args.all and not getattr( args, 'enable_' + gadget[ 'language' ] ):
continue
if getattr( args, 'disable_' + gadget[ 'language' ] ):
continue
langs = gadget[ 'language' ]
if not isinstance(langs, list): langs = [langs]
skip = 0
for lang in langs:
if not gadget.get( 'enabled', True ):
if ( not args.force_all
and not getattr( args, 'force_enable_' + lang) ):
skip = skip + 1
continue
else:
if not args.all and not getattr( args, 'enable_' + lang ):
skip = skip + 1
continue
if getattr( args, 'disable_' + lang ):
skip = skip + 1
continue
if skip == len(langs): continue
if not args.upgrade:
manifest.Clear( name )

View file

@ -21,7 +21,7 @@ import os
GADGETS = {
'vscode-cpptools': {
'language': 'c',
'language': ['c','cpp'],
'download': {
'url': 'https://github.com/Microsoft/vscode-cpptools/releases/download/'
'${version}/${file_name}',
@ -225,7 +225,7 @@ GADGETS = {
},
},
'netcoredbg': {
'language': 'csharp',
'language': ['csharp', 'fsharp', 'vbnet'],
'enabled': False,
'download': {
'url': ( 'https://github.com/Samsung/netcoredbg/releases/download/'

View file

@ -229,10 +229,13 @@ def GadgetListToInstallerArgs( *gadget_list ):
except KeyError:
continue
lang = gadget[ "language" ]
if isinstance(lang, list): lang = lang[0]
if not gadget.get( 'enabled', True ):
installer_args.append( f'--force-enable-{ gadget[ "language" ] }' )
installer_args.append( f'--force-enable-{lang}' )
else:
installer_args.append( f'--enable-{ gadget[ "language" ] }' )
installer_args.append( f'--enable-{lang}' )
return installer_args