History

python: Add SQL syntax highlighting (#43756)

Release Notes: - Added support for SQL syntax highlighting in Python files ## Summary I am a data engineer who spends a lot of time writing SQL in Python files using Zed. This PR adds support for SQL syntax highlighting with common libraries (like pyspark, polars, pandas) and string variables (prefixed with a `# sql` comment). I referenced [#37605](https://github.com/zed-industries/zed/pull/37605) for this implementation to keep the comment prefix consistent. ## Examples <img width="738" height="990" alt="image" src="https://github.com/user-attachments/assets/48a859da-c477-490d-be73-ca70d8e47cc9" /> ---------

Jeff Brennan committed 11 months ago

Commit c20cbba1 parent f2f3d9f2 files · +50 −0Browse files

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

Unified · Split

docs/src/languages/python.md+19−0
@@ -258,6 +258,25 @@ quote-style = "single" · 257 unmodified lines
258 258
259For more details, refer to the Ruff documentation about [configuration files](https://docs.astral.sh/ruff/configuration/) and [language server settings](https://docs.astral.sh/ruff/editors/settings/), and the [list of options](https://docs.astral.sh/ruff/settings/).259For more details, refer to the Ruff documentation about [configuration files](https://docs.astral.sh/ruff/configuration/) and [language server settings](https://docs.astral.sh/ruff/editors/settings/), and the [list of options](https://docs.astral.sh/ruff/settings/).
260 260
261### Embedded Language Highlighting
262
263Zed supports syntax highlighting for code embedded in Python strings by adding a comment with the language name.
264
265```python
266# sql
267query = "SELECT * FROM users"
268
269#sql
270query = """
271 SELECT *
272 FROM users
273"""
274
275result = func( #sql
276 "SELECT * FROM users"
277)
278```
279
261## Debugging280## Debugging
262 281
263Zed supports Python debugging through the `debugpy` adapter. You can start with no configuration or define custom launch profiles in `.zed/debug.json`.282Zed supports Python debugging through the `debugpy` adapter. You can start with no configuration or define custom launch profiles in `.zed/debug.json`.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t