History

Move language-specific debugging docs to the page for each language (#33692)

Release Notes: - N/A

Cole Miller committed 1 year ago

Commit b7bfdd31 parent 0e2e5b813 files · +409 −343Browse files

Showing the changes to docs/src/languages/python.md (1 of 13 files). Show all

Unified · Split

docs/src/languages/python.md+65−0
@@ -6,6 +6,7 @@ Python support is available natively in Zed. · 5 unmodified lines
6- Language Servers:6- Language Servers:
7 - [microsoft/pyright](https://github.com/microsoft/pyright)7 - [microsoft/pyright](https://github.com/microsoft/pyright)
8 - [python-lsp/python-lsp-server](https://github.com/python-lsp/python-lsp-server) (PyLSP)8 - [python-lsp/python-lsp-server](https://github.com/python-lsp/python-lsp-server) (PyLSP)
9- Debug Adapter: [debugpy](https://github.com/microsoft/debugpy)
9 10
10## Language Servers11## Language Servers
11 12
@@ -125,3 +126,67 @@ A common tool for formatting Python code is [Ruff](https://docs.astral.sh/ruff/) · 113 unmodified lines
125TBD: Expand Python Ruff docs.126TBD: Expand Python Ruff docs.
126TBD: Ruff pyproject.toml, ruff.toml docs. `ruff.configuration`.127TBD: Ruff pyproject.toml, ruff.toml docs. `ruff.configuration`.
127-->128-->
129
130## Debugging
131
132Zed supports zero-configuration debugging of Python module entry points and pytest tests.
133Run {#action debugger::Start} ({#kb debugger::Start}) to see a contextual list for the current project.
134For greater control, you can add debug configurations to `.zed/debug.json`. See the examples below.
135
136### Debug Active File
137
138```json
139[
140 {
141 "label": "Python Active File",
142 "adapter": "Debugpy",
143 "program": "$ZED_FILE",
144 "request": "launch"
145 }
146]
147```
148
149### Flask App
150
151For a common Flask Application with a file structure similar to the following:
152
153```
154.venv/
155app/
156 init.py
157 main.py
158 routes.py
159templates/
160 index.html
161static/
162 style.css
163requirements.txt
164```
165
166…the following configuration can be used:
167
168```json
169[
170 {
171 "label": "Python: Flask",
172 "adapter": "Debugpy",
173 "request": "launch",
174 "module": "app",
175 "cwd": "$ZED_WORKTREE_ROOT",
176 "env": {
177 "FLASK_APP": "app",
178 "FLASK_DEBUG": "1"
179 },
180 "args": [
181 "run",
182 "--reload", // Enables Flask reloader that watches for file changes
183 "--debugger" // Enables Flask debugger
184 ],
185 "autoReload": {
186 "enable": true
187 },
188 "jinja": true,
189 "justMyCode": true
190 }
191]
192```