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:
Ben Jackson 2020-02-08 18:05:21 +00:00
commit a56bee7b0a
5 changed files with 76 additions and 36 deletions

View file

@ -38,6 +38,13 @@ def Settings( **kwargs ):
}
}
if kwargs[ 'language' ] == 'python':
return {
'sys_path': [
p.join( PATH_TO_THIS_DIR, 'python3' )
]
}
if IgnoreExtraConf:
raise IgnoreExtraConf()

View file

@ -15,7 +15,7 @@ stages:
- bash: pip3 install -r dev_requirements.txt
displayName: "Install requirements"
- bash: $HOME/.local/bin/flake8 python3/
- bash: '$HOME/.local/bin/flake8 python3/ *.py'
displayName: "Run flake8"
- job: 'Vimscript'

View file

@ -55,7 +55,7 @@ GADGETS = {
'url': 'https://github.com/Microsoft/vscode-cpptools/releases/download/'
'${version}/${file_name}',
},
'do': lambda name, root: InstallCppTools( name, root ),
'do': lambda name, root, gadget: InstallCppTools( name, root, gadget ),
'all': {
'version': '0.26.3',
},
@ -87,7 +87,8 @@ GADGETS = {
},
},
'vscode-python': {
'language': 'python',
'language': 'python.legacy',
'enabled': False,
'download': {
'url': 'https://github.com/Microsoft/vscode-python/releases/download/'
'${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': {
'language': 'java',
'enabled': False,
@ -163,7 +189,7 @@ GADGETS = {
'url': 'https://github.com/puremourning/TclProDebug',
'ref': 'f5c56b7067661ce84e205765060224076569ae0e', # master 26/10/2019
},
'do': lambda name, root: InstallTclProDebug( name, root )
'do': lambda name, root, gadget: InstallTclProDebug( name, root, gadget )
},
'netcoredbg': {
'language': 'csharp',
@ -184,9 +210,10 @@ GADGETS = {
'file_name': 'netcoredbg-linux-master.tar.gz',
'checksum': '',
},
'do': lambda name, root: MakeSymlink( gadget_dir,
name,
os.path.join( root, 'netcoredbg' ) ),
'do': lambda name, root, gadget: MakeSymlink(
gadget_dir,
name,
os.path.join( root, 'netcoredbg' ) ),
'adapters': {
'netcoredbg': {
"name": "netcoredbg",
@ -242,7 +269,7 @@ GADGETS = {
'checksum':
'502ee5732851fc4f309294fc296a291b1a114008a1fbcb232f3763be2b8d9c1f',
},
'do': lambda name, root: InstallBashDebug( name, root ),
'do': lambda name, root, gadget: InstallBashDebug( name, root, gadget ),
'adapters': {
"vscode-bash": {
"name": "bashdb",
@ -297,8 +324,9 @@ GADGETS = {
'language': 'php',
'enabled': False,
'download': {
'url': 'https://github.com/felixfbecker/vscode-php-debug/releases/download/'
'${version}/${file_name}',
'url':
'https://github.com/felixfbecker/vscode-php-debug/releases/download/'
'${version}/${file_name}',
},
'all': {
'version': 'v1.13.0',
@ -323,7 +351,7 @@ GADGETS = {
'url': 'https://github.com/microsoft/vscode-node-debug2',
'ref': 'v1.39.1',
},
'do': lambda name, root: InstallNodeDebug( name, root ),
'do': lambda name, root, gadget: InstallNodeDebug( name, root, gadget ),
'adapters': {
'vscode-node': {
'name': 'node2',
@ -381,7 +409,7 @@ def MakeExecutable( file_path ):
os.chmod( file_path, 0o755 )
def InstallCppTools( name, root ):
def InstallCppTools( name, root, gadget ):
extension = os.path.join( root, 'extension' )
# 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 )
def InstallBashDebug( name, root ):
def InstallBashDebug( name, root, gadget ):
MakeExecutable( os.path.join( root, 'extension', 'bashdb_dir', 'bashdb' ) )
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' ]
if OS == 'macos':
@ -440,7 +480,7 @@ def InstallTclProDebug( name, root ):
MakeSymlink( gadget_dir, name, root )
def InstallNodeDebug( name, root ):
def InstallNodeDebug( name, root, gadget ):
node_version = subprocess.check_output( [ 'node', '--version' ],
universal_newlines=True ).strip()
print( "Node.js version: {}".format( node_version ) )
@ -485,7 +525,11 @@ def 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:
file_name = url.split( '/' )[ -1 ]
@ -729,7 +773,7 @@ for name, gadget in GADGETS.items():
root = destination
if 'do' in gadget:
gadget[ 'do' ]( name, root )
gadget[ 'do' ]( name, root, v )
else:
MakeExtensionSymlink( name, root )

View file

@ -217,6 +217,11 @@ class ProjectBreakpoints( object ):
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: the line numbers might have changed since pressing the F9 key!
@ -272,9 +277,6 @@ class ProjectBreakpoints( object ):
failure_handler = lambda *_: response_received()
)
if self._exception_breakpoints is None:
self._SetUpExceptionBreakpoints( self._configured_breakpoints )
if self._exception_breakpoints:
awaiting = awaiting + 1
self._connection.DoRequest(

View file

@ -1,19 +1,6 @@
{
"adapters": {
"debugpy": {
"command": [
"python",
"-m",
"debugpy.adapter"
],
"name": "debugpy",
"configuration": {
"python": "python"
}
}
},
"configurations": {
"run": {
"run legacy vscode-python": {
"adapter": "vscode-python",
"configuration": {
"request": "launch",
@ -45,14 +32,14 @@
}
}
},
"run - debugpy": {
"run": {
"adapter": "debugpy",
"configuration": {
"request": "launch",
"type": "python",
"cwd": "${workspaceRoot}",
"program": "${file}",
"stopOnEntry": true,
"stopOnEntry": false,
"console": "integratedTerminal"
},
"breakpoints": {