Merge pull request #317 from yatli/master

multiple languages per adapter
This commit is contained in:
mergify[bot] 2021-01-09 11:50:10 +00:00 • committed by GitHub
commit 1556e63ef0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 66 additions and 48 deletions

View file

@ -134,21 +134,22 @@ runtime dependencies). They are categorised by their level of support:
* `Experimental`: Working, but not frequently used and rarely tested * `Experimental`: Working, but not frequently used and rarely tested
* `Legacy`: No longer supported, please migrate your config * `Legacy`: No longer supported, please migrate your config
| Language | Status | Switch (for `install_gadget.py`) | Adapter (for `:VimspectorInstall`) | Dependencies | | Language | Status | Switch (for `install_gadget.py`) | Adapter (for `:VimspectorInstall`) | Dependencies |
|--------------------|--------------|----------------------------------|------------------------------------|--------------------------------------------| |--------------------|--------------|------------------------------------|------------------------------------|--------------------------------------------|
| C, C++, etc. | Tested | `--all` or `--enable-c` | vscode-cpptools | mono-core | | C, C++, Rust etc. | Tested | `--all` or `--enable-c` (or cpp) | vscode-cpptools | mono-core |
| Rust, C, C++, etc. | Supported | `--force-enable-rust` | CodeLLDB | Python 3 | | Rust, C, C++, etc. | Supported | `--force-enable-rust` | CodeLLDB | Python 3 |
| Python | Tested | `--all` or `--enable-python` | debugpy | Python 2.7 or Python 3 | | Python | Tested | `--all` or `--enable-python` | debugpy | Python 2.7 or Python 3 |
| Go | Tested | `--enable-go` | vscode-go | Go, [Delve][] | | Go | Tested | `--enable-go` | vscode-go | Go, [Delve][] |
| TCL | Supported | `--all` or `--enable-tcl` | tclpro | TCL 8.5 | | TCL | Supported | `--all` or `--enable-tcl` | tclpro | TCL 8.5 |
| Bourne Shell | Supported | `--all` or `--enable-bash` | vscode-bash-debug | Bash v?? | | Bourne Shell | Supported | `--all` or `--enable-bash` | vscode-bash-debug | Bash v?? |
| Lua | Supported | `--all` or `--enable-lua` | local-lua-debugger-vscode | Node >=12.13.0, Npm, Lua interpreter | | Lua | Supported | `--all` or `--enable-lua` | local-lua-debugger-vscode | Node >=12.13.0, Npm, Lua interpreter |
| Node.js | Supported | `--force-enable-node` | vscode-node-debug2 | 6 < Node < 12, Npm | | Node.js | Supported | `--force-enable-node` | vscode-node-debug2 | 6 < Node < 12, Npm |
| Javascript | Supported | `--force-enable-chrome` | debugger-for-chrome | Chrome | | Javascript | Supported | `--force-enable-chrome` | debugger-for-chrome | Chrome |
| Java | Supported | `--force-enable-java ` | vscode-java-debug | Compatible LSP plugin (see [later](#java)) | | Java | Supported | `--force-enable-java ` | vscode-java-debug | Compatible LSP plugin (see [later](#java)) |
| C# (dotnet core) | Experimental | `--force-enable-csharp` | netcoredbg | DotNet core | | C# (dotnet core) | Experimental | `--force-enable-csharp` | netcoredbg | DotNet core |
| C# (mono) | Experimental | `--force-enable-csharp` | vscode-mono-debug | Mono | | C# (mono) | Experimental | `--force-enable-csharp` | vscode-mono-debug | Mono |
| Python.legacy | Legacy | `--force-enable-python.legacy` | vscode-python | Node 10, Python 2.7 or Python 3 | | F#, VB, etc. | Experimental | `--force-enable-fsharp` (or vbnet) | netcoredbg | DotNet core |
| Python.legacy | Legacy | `--force-enable-python.legacy` | vscode-python | Node 10, Python 2.7 or Python 3 |
## Other languages ## Other languages

View file

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

View file

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

View file

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