Switch to debugpy over vscode-python
This is just better in every way, and the vscode-python typescript adapter is being phased out.
This commit is contained in:
parent
933f946801
commit
a56bee7b0a
5 changed files with 76 additions and 36 deletions
|
|
@ -38,6 +38,13 @@ def Settings( **kwargs ):
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if kwargs[ 'language' ] == 'python':
|
||||||
|
return {
|
||||||
|
'sys_path': [
|
||||||
|
p.join( PATH_TO_THIS_DIR, 'python3' )
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
if IgnoreExtraConf:
|
if IgnoreExtraConf:
|
||||||
raise IgnoreExtraConf()
|
raise IgnoreExtraConf()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ stages:
|
||||||
- bash: pip3 install -r dev_requirements.txt
|
- bash: pip3 install -r dev_requirements.txt
|
||||||
displayName: "Install requirements"
|
displayName: "Install requirements"
|
||||||
|
|
||||||
- bash: $HOME/.local/bin/flake8 python3/
|
- bash: '$HOME/.local/bin/flake8 python3/ *.py'
|
||||||
displayName: "Run flake8"
|
displayName: "Run flake8"
|
||||||
|
|
||||||
- job: 'Vimscript'
|
- job: 'Vimscript'
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ GADGETS = {
|
||||||
'url': 'https://github.com/Microsoft/vscode-cpptools/releases/download/'
|
'url': 'https://github.com/Microsoft/vscode-cpptools/releases/download/'
|
||||||
'${version}/${file_name}',
|
'${version}/${file_name}',
|
||||||
},
|
},
|
||||||
'do': lambda name, root: InstallCppTools( name, root ),
|
'do': lambda name, root, gadget: InstallCppTools( name, root, gadget ),
|
||||||
'all': {
|
'all': {
|
||||||
'version': '0.26.3',
|
'version': '0.26.3',
|
||||||
},
|
},
|
||||||
|
|
@ -87,7 +87,8 @@ GADGETS = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'vscode-python': {
|
'vscode-python': {
|
||||||
'language': 'python',
|
'language': 'python.legacy',
|
||||||
|
'enabled': False,
|
||||||
'download': {
|
'download': {
|
||||||
'url': 'https://github.com/Microsoft/vscode-python/releases/download/'
|
'url': 'https://github.com/Microsoft/vscode-python/releases/download/'
|
||||||
'${version}/${file_name}',
|
'${version}/${file_name}',
|
||||||
|
|
@ -108,6 +109,31 @@ GADGETS = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
'debugpy': {
|
||||||
|
'language': 'python',
|
||||||
|
'download': {
|
||||||
|
'url': 'https://github.com/microsoft/debugpy/archive/${file_name}'
|
||||||
|
},
|
||||||
|
'all': {
|
||||||
|
'version': '1.0.0b1',
|
||||||
|
'file_name': 'v1.0.0b1.zip',
|
||||||
|
'checksum':
|
||||||
|
'eb26ac276213bcf26aaeadd7c3c284f7a20f43b63331822831a783dea558e60e'
|
||||||
|
},
|
||||||
|
'do': lambda name, root, gadget: InstallDebugpy( name, root, gadget ),
|
||||||
|
'adapters': {
|
||||||
|
'debugpy': {
|
||||||
|
"command": [
|
||||||
|
"python3",
|
||||||
|
"${gadgetDir}/debugpy/build/lib/debugpy/adapter"
|
||||||
|
],
|
||||||
|
"name": "debugpy",
|
||||||
|
"configuration": {
|
||||||
|
"python": sys.executable
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
'vscode-java-debug': {
|
'vscode-java-debug': {
|
||||||
'language': 'java',
|
'language': 'java',
|
||||||
'enabled': False,
|
'enabled': False,
|
||||||
|
|
@ -163,7 +189,7 @@ GADGETS = {
|
||||||
'url': 'https://github.com/puremourning/TclProDebug',
|
'url': 'https://github.com/puremourning/TclProDebug',
|
||||||
'ref': 'f5c56b7067661ce84e205765060224076569ae0e', # master 26/10/2019
|
'ref': 'f5c56b7067661ce84e205765060224076569ae0e', # master 26/10/2019
|
||||||
},
|
},
|
||||||
'do': lambda name, root: InstallTclProDebug( name, root )
|
'do': lambda name, root, gadget: InstallTclProDebug( name, root, gadget )
|
||||||
},
|
},
|
||||||
'netcoredbg': {
|
'netcoredbg': {
|
||||||
'language': 'csharp',
|
'language': 'csharp',
|
||||||
|
|
@ -184,9 +210,10 @@ GADGETS = {
|
||||||
'file_name': 'netcoredbg-linux-master.tar.gz',
|
'file_name': 'netcoredbg-linux-master.tar.gz',
|
||||||
'checksum': '',
|
'checksum': '',
|
||||||
},
|
},
|
||||||
'do': lambda name, root: MakeSymlink( gadget_dir,
|
'do': lambda name, root, gadget: MakeSymlink(
|
||||||
name,
|
gadget_dir,
|
||||||
os.path.join( root, 'netcoredbg' ) ),
|
name,
|
||||||
|
os.path.join( root, 'netcoredbg' ) ),
|
||||||
'adapters': {
|
'adapters': {
|
||||||
'netcoredbg': {
|
'netcoredbg': {
|
||||||
"name": "netcoredbg",
|
"name": "netcoredbg",
|
||||||
|
|
@ -242,7 +269,7 @@ GADGETS = {
|
||||||
'checksum':
|
'checksum':
|
||||||
'502ee5732851fc4f309294fc296a291b1a114008a1fbcb232f3763be2b8d9c1f',
|
'502ee5732851fc4f309294fc296a291b1a114008a1fbcb232f3763be2b8d9c1f',
|
||||||
},
|
},
|
||||||
'do': lambda name, root: InstallBashDebug( name, root ),
|
'do': lambda name, root, gadget: InstallBashDebug( name, root, gadget ),
|
||||||
'adapters': {
|
'adapters': {
|
||||||
"vscode-bash": {
|
"vscode-bash": {
|
||||||
"name": "bashdb",
|
"name": "bashdb",
|
||||||
|
|
@ -297,8 +324,9 @@ GADGETS = {
|
||||||
'language': 'php',
|
'language': 'php',
|
||||||
'enabled': False,
|
'enabled': False,
|
||||||
'download': {
|
'download': {
|
||||||
'url': 'https://github.com/felixfbecker/vscode-php-debug/releases/download/'
|
'url':
|
||||||
'${version}/${file_name}',
|
'https://github.com/felixfbecker/vscode-php-debug/releases/download/'
|
||||||
|
'${version}/${file_name}',
|
||||||
},
|
},
|
||||||
'all': {
|
'all': {
|
||||||
'version': 'v1.13.0',
|
'version': 'v1.13.0',
|
||||||
|
|
@ -323,7 +351,7 @@ GADGETS = {
|
||||||
'url': 'https://github.com/microsoft/vscode-node-debug2',
|
'url': 'https://github.com/microsoft/vscode-node-debug2',
|
||||||
'ref': 'v1.39.1',
|
'ref': 'v1.39.1',
|
||||||
},
|
},
|
||||||
'do': lambda name, root: InstallNodeDebug( name, root ),
|
'do': lambda name, root, gadget: InstallNodeDebug( name, root, gadget ),
|
||||||
'adapters': {
|
'adapters': {
|
||||||
'vscode-node': {
|
'vscode-node': {
|
||||||
'name': 'node2',
|
'name': 'node2',
|
||||||
|
|
@ -381,7 +409,7 @@ def MakeExecutable( file_path ):
|
||||||
os.chmod( file_path, 0o755 )
|
os.chmod( file_path, 0o755 )
|
||||||
|
|
||||||
|
|
||||||
def InstallCppTools( name, root ):
|
def InstallCppTools( name, root, gadget ):
|
||||||
extension = os.path.join( root, 'extension' )
|
extension = os.path.join( root, 'extension' )
|
||||||
|
|
||||||
# It's hilarious, but the execute bits aren't set in the vsix. So they
|
# It's hilarious, but the execute bits aren't set in the vsix. So they
|
||||||
|
|
@ -400,12 +428,24 @@ def InstallCppTools( name, root ):
|
||||||
MakeExtensionSymlink( name, root )
|
MakeExtensionSymlink( name, root )
|
||||||
|
|
||||||
|
|
||||||
def InstallBashDebug( name, root ):
|
def InstallBashDebug( name, root, gadget ):
|
||||||
MakeExecutable( os.path.join( root, 'extension', 'bashdb_dir', 'bashdb' ) )
|
MakeExecutable( os.path.join( root, 'extension', 'bashdb_dir', 'bashdb' ) )
|
||||||
MakeExtensionSymlink( name, root )
|
MakeExtensionSymlink( name, root )
|
||||||
|
|
||||||
|
|
||||||
def InstallTclProDebug( name, root ):
|
def InstallDebugpy( name, root, gadget ):
|
||||||
|
wd = os.getcwd()
|
||||||
|
root = os.path.join( root, 'debugpy-{}'.format( gadget[ 'version' ] ) )
|
||||||
|
os.chdir( root )
|
||||||
|
try:
|
||||||
|
subprocess.check_call( [ sys.executable, 'setup.py', 'build' ] )
|
||||||
|
finally:
|
||||||
|
os.chdir( wd )
|
||||||
|
|
||||||
|
MakeSymlink( gadget_dir, name, root )
|
||||||
|
|
||||||
|
|
||||||
|
def InstallTclProDebug( name, root, gadget ):
|
||||||
configure = [ './configure' ]
|
configure = [ './configure' ]
|
||||||
|
|
||||||
if OS == 'macos':
|
if OS == 'macos':
|
||||||
|
|
@ -440,7 +480,7 @@ def InstallTclProDebug( name, root ):
|
||||||
MakeSymlink( gadget_dir, name, root )
|
MakeSymlink( gadget_dir, name, root )
|
||||||
|
|
||||||
|
|
||||||
def InstallNodeDebug( name, root ):
|
def InstallNodeDebug( name, root, gadget ):
|
||||||
node_version = subprocess.check_output( [ 'node', '--version' ],
|
node_version = subprocess.check_output( [ 'node', '--version' ],
|
||||||
universal_newlines=True ).strip()
|
universal_newlines=True ).strip()
|
||||||
print( "Node.js version: {}".format( node_version ) )
|
print( "Node.js version: {}".format( node_version ) )
|
||||||
|
|
@ -485,7 +525,11 @@ def UrlOpen( *args, **kwargs ):
|
||||||
return urllib2.urlopen( *args, **kwargs )
|
return urllib2.urlopen( *args, **kwargs )
|
||||||
|
|
||||||
|
|
||||||
def DownloadFileTo( url, destination, file_name = None, checksum = None, sslcheck = True):
|
def DownloadFileTo( url,
|
||||||
|
destination,
|
||||||
|
file_name = None,
|
||||||
|
checksum = None,
|
||||||
|
sslcheck = True):
|
||||||
if not file_name:
|
if not file_name:
|
||||||
file_name = url.split( '/' )[ -1 ]
|
file_name = url.split( '/' )[ -1 ]
|
||||||
|
|
||||||
|
|
@ -729,7 +773,7 @@ for name, gadget in GADGETS.items():
|
||||||
root = destination
|
root = destination
|
||||||
|
|
||||||
if 'do' in gadget:
|
if 'do' in gadget:
|
||||||
gadget[ 'do' ]( name, root )
|
gadget[ 'do' ]( name, root, v )
|
||||||
else:
|
else:
|
||||||
MakeExtensionSymlink( name, root )
|
MakeExtensionSymlink( name, root )
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -217,6 +217,11 @@ class ProjectBreakpoints( object ):
|
||||||
response_received()
|
response_received()
|
||||||
|
|
||||||
|
|
||||||
|
# NOTE: Must do this _first_ otherwise we might send requests and get
|
||||||
|
# replies before we finished sending all the requests.
|
||||||
|
if self._exception_breakpoints is None:
|
||||||
|
self._SetUpExceptionBreakpoints( self._configured_breakpoints )
|
||||||
|
|
||||||
|
|
||||||
# TODO: add the _configured_breakpoints to line_breakpoints
|
# TODO: add the _configured_breakpoints to line_breakpoints
|
||||||
# TODO: the line numbers might have changed since pressing the F9 key!
|
# TODO: the line numbers might have changed since pressing the F9 key!
|
||||||
|
|
@ -272,9 +277,6 @@ class ProjectBreakpoints( object ):
|
||||||
failure_handler = lambda *_: response_received()
|
failure_handler = lambda *_: response_received()
|
||||||
)
|
)
|
||||||
|
|
||||||
if self._exception_breakpoints is None:
|
|
||||||
self._SetUpExceptionBreakpoints( self._configured_breakpoints )
|
|
||||||
|
|
||||||
if self._exception_breakpoints:
|
if self._exception_breakpoints:
|
||||||
awaiting = awaiting + 1
|
awaiting = awaiting + 1
|
||||||
self._connection.DoRequest(
|
self._connection.DoRequest(
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,6 @@
|
||||||
{
|
{
|
||||||
"adapters": {
|
|
||||||
"debugpy": {
|
|
||||||
"command": [
|
|
||||||
"python",
|
|
||||||
"-m",
|
|
||||||
"debugpy.adapter"
|
|
||||||
],
|
|
||||||
"name": "debugpy",
|
|
||||||
"configuration": {
|
|
||||||
"python": "python"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"configurations": {
|
"configurations": {
|
||||||
"run": {
|
"run legacy vscode-python": {
|
||||||
"adapter": "vscode-python",
|
"adapter": "vscode-python",
|
||||||
"configuration": {
|
"configuration": {
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
|
|
@ -45,14 +32,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"run - debugpy": {
|
"run": {
|
||||||
"adapter": "debugpy",
|
"adapter": "debugpy",
|
||||||
"configuration": {
|
"configuration": {
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"type": "python",
|
"type": "python",
|
||||||
"cwd": "${workspaceRoot}",
|
"cwd": "${workspaceRoot}",
|
||||||
"program": "${file}",
|
"program": "${file}",
|
||||||
"stopOnEntry": true,
|
"stopOnEntry": false,
|
||||||
"console": "integratedTerminal"
|
"console": "integratedTerminal"
|
||||||
},
|
},
|
||||||
"breakpoints": {
|
"breakpoints": {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue