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" /> --------- Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
This commit is contained in:
1 parent
ef09a2ab3b
commit
81d5e07743
2 files changed
+50
No files matched your search
@@ -258,6 +258,25 @@ quote-style = "single"
|
||||
|
||||
For 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/).
|
||||
|
||||
### Embedded Language Highlighting
|
||||
|
||||
Zed supports syntax highlighting for code embedded in Python strings by adding a comment with the language name.
|
||||
|
||||
```python
|
||||
# sql
|
||||
query = "SELECT * FROM users"
|
||||
|
||||
#sql
|
||||
query = """
|
||||
SELECT *
|
||||
FROM users
|
||||
"""
|
||||
|
||||
result = func( #sql
|
||||
"SELECT * FROM users"
|
||||
)
|
||||
```
|
||||
|
||||
## Debugging
|
||||
|
||||
Zed supports Python debugging through the `debugpy` adapter. You can start with no configuration or define custom launch profiles in `.zed/debug.json`.
|
||||
|
||||
Reference in new issue
Block a user