Skip to content

Commit

Permalink
Update VS Code debugging setting and instructions (#1208)
Browse files Browse the repository at this point in the history
* Update VS Code debugging setting and instructions

* Update debug_in_vs_code.md

Fix typo in doc
  • Loading branch information
troydai authored and tjprescott committed Nov 2, 2016
1 parent 9096fe5 commit 69e6628
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 33 deletions.
70 changes: 37 additions & 33 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,39 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Python",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"pythonPath":"python",
"program": "${workspaceRoot}/src/azure/cli/__main__.py",
"cwd": "${workspaceRoot}/src",
"args": ["login", "--help"],
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit",
"RedirectOutput"
]
},
{
"name": "Python3",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"pythonPath":"python3",
"program": "${workspaceRoot}/src/azure/cli/__main__.py",
"cwd": "${workspaceRoot}/src",
"args": ["login", "--help"],
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit",
"RedirectOutput"
]
}
]
"version": "0.2.0",
"configurations": [
{
"name": "Integrated Terminal/Console",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"pythonPath": "${config.python.pythonPath}",
"program": "${workspaceRoot}/src/azure-cli/azure/cli/__main__.py",
"cwd": "${workspaceRoot}",
"args": [
"--help"
],
"console": "integratedTerminal",
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit"
]
},
{
"name": "External Terminal/Console",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"pythonPath": "${config.python.pythonPath}",
"program": "${workspaceRoot}/src/azure-cli/azure/cli/__main__.py",
"cwd": "${workspaceRoot}",
"args": [
"--help"
],
"console": "externalTerminal",
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit"
]
}
]
}
27 changes: 27 additions & 0 deletions doc/debug/debug_in_vs_code.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Debug in Visual Studio Code

## Prerequisite

* Visual Studio Code [Link](http://code.visualstudio.com/)
* Visual Studio Code Python Extension [Link](https://marketplace.visualstudio.com/items?itemName=donjayamanne.python)
* Python 2.7 or 3.5
* Set up development environment [Link](https://github.com/Azure/azure-cli/blob/master/doc/configuring_your_machine.md)

## Quick start

1. Start VS Code at the root of the `azure-cli` source code folder.
2. Switch to [debug panel](https://code.visualstudio.com/Docs/editor/debugging). (CMD + Shift + D)
3. Select one of the debug configuration in the dropdown on top of the debug panel.
4. Start debugging (Press F5 or click the play button)

## Configuration

The `launch.json` under `.vscode` folder has already been pre-configured to enable execute `az --help` and break in to debug immediately. You can update it to execute the scenario you need.

1. Set `false` to `stopOnEntry` property to break at the first break point you specified.
2. Update `args` array to run specified command. You need to make sure the arguments are split by space.
3. Choose between external termninal and integrated termninal. The latter can be toggle by Ctrl + `
4. Set `config.python.pythonPath` in either user setting or workspace setting to pick the version of python to be executed.

## Reference
- `launch.json` schema: https://code.visualstudio.com/Docs/editor/debugging

0 comments on commit 69e6628

Please sign in to comment.