File: debug_in_vs_code.md

package info (click to toggle)
azure-cli 2.83.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,346,000 kB
  • sloc: python: 1,930,197; sh: 1,344; makefile: 407; cs: 145; javascript: 74; sql: 37; xml: 21
file content (26 lines) | stat: -rw-r--r-- 1,278 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 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=ms-python.python)
* Python 3.10+
* 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 the `args` array to run specified command. You need to make sure the arguments are split by space. 
3. Choose between external terminal and integrated terminal. The latter can be toggle by Ctrl + `

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