-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update VS Code debugging setting and instructions (#1208)
* Update VS Code debugging setting and instructions * Update debug_in_vs_code.md Fix typo in doc
- Loading branch information
1 parent
9096fe5
commit 69e6628
Showing
2 changed files
with
64 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |