Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demo of python attach #64

Merged
merged 3 commits into from
Oct 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,13 @@ stages:
go get -u github.com/go-delve/delve/cmd/dlv
displayName: 'Install Delve for Go'

# TODO: Use cache to store the download directory
- bash: python3 install_gadget.py --all --force-all
- task: CacheBeta@0
inputs:
key: v1 | gadgets | $(Agent.OS) | install_gadget.py
path: gadgets/linux/download
displayName: Cache gadgets

- bash: python3 install_gadget.py --all
displayName: 'Install gadgets - python3'

- bash: vim --version
Expand Down Expand Up @@ -78,7 +83,13 @@ stages:
- bash: go get -u github.com/go-delve/delve/cmd/dlv
displayName: 'Install Delve for Go'

- bash: python3 install_gadget.py --all --force-all
- task: CacheBeta@0
inputs:
key: v1 | gadgets | $(Agent.OS) | install_gadget.py
path: gadgets/macos/download
displayName: Cache gadgets

- bash: python3 install_gadget.py --all
displayName: 'Install gadgets - python3'

- bash: vim --version
Expand Down
2 changes: 1 addition & 1 deletion install_gadget.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
'language': 'tcl',
'repo': {
'url': 'https://github.com/puremourning/TclProDebug',
'ref': 'master',
'ref': 'f5c56b7067661ce84e205765060224076569ae0e', # master 26/10/2019
},
'do': lambda name, root: InstallTclProDebug( name, root )
},
Expand Down
4 changes: 3 additions & 1 deletion python3/vimspector/debug_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ def Start( self, launch_variables = {} ):

adapters.update( database.get( 'adapters' ) or {} )

if len( configurations ) == 1:
if 'configuration' in launch_variables:
configuration_name = launch_variables.pop( 'configuration' )
elif len( configurations ) == 1:
configuration_name = next( iter( configurations.keys() ) )
else:
configuration_name = utils.SelectFromList(
Expand Down
1 change: 1 addition & 0 deletions support/test/python/simple_python/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
env/
9 changes: 9 additions & 0 deletions support/test/python/simple_python/.vimspector.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@
"stopOnEntry": true,
"console": "integratedTerminal"
}
},
"attach": {
"adapter": "vscode-python",
"configuration": {
"request": "attach",
"type": "python",
"host": "localhost",
"port": "5678"
}
}
}
}
1 change: 1 addition & 0 deletions support/test/python/simple_python/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ptvsd==4.3.2
19 changes: 19 additions & 0 deletions support/test/python/simple_python/run_with_ptvsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

PYTHON=python3

if [ -n "$1" ]; then
PYTHON=$1
fi

pushd $(dirname $0)
if [ ! -d env ]; then
virtualenv -p $PYTHON env
fi

. env/bin/activate
pip install -r requirements.txt

python -m ptvsd --wait --host localhost --port 5678 main.py
popd

2 changes: 1 addition & 1 deletion tests/language_python.test.vim
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ with patch( 'vimspector.utils.SelectFromList',
return_value=None ) as p:
with patch( 'vimspector.utils.AskForInput',
return_value=None ) as p:
vim.eval( 'feedkeys( "\<F5>", "xt" )' )
vim.eval( 'vimspector#LaunchWithSettings( { "configuration": "run" } )' )
vim.eval( 'vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 6, 1 )' )
p.assert_called()
EOF
Expand Down