Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python: Highlight attribute docstrings #20763

Merged
merged 4 commits into from
Nov 19, 2024

Conversation

JaagupAverin
Copy link
Contributor

@JaagupAverin JaagupAverin commented Nov 16, 2024

Adds more docstring highlights missing from #20486.
PEP257 defines attribute docstrings as

String literals occurring immediately after a simple assignment at the top level of a module, class, or init method are called “attribute docstrings”.

This PR adds @string.doc for such cases.
Before:
Screenshot_20241116_162257
After:
Screenshot_20241116_162457

Release Notes:

  • Added Python syntax highlighting for attribute docstrings.

Copy link

cla-bot bot commented Nov 16, 2024

We require contributors to sign our Contributor License Agreement, and we don't have @JaagupAverin on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@JaagupAverin
Copy link
Contributor Author

@cla-bot check

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Nov 16, 2024
Copy link

cla-bot bot commented Nov 16, 2024

The cla-bot has been summoned, and re-checked this pull request!

@maxdeviant maxdeviant changed the title python: Highlight attribute docstrings and add triple-quote closing. python: Highlight attribute docstrings and add triple-quote closing Nov 16, 2024
@JaagupAverin JaagupAverin changed the title python: Highlight attribute docstrings and add triple-quote closing python: Highlight attribute docstrings Nov 16, 2024
@osiewicz osiewicz merged commit 7853e32 into zed-industries:main Nov 19, 2024
12 checks passed
@osiewicz
Copy link
Contributor

Thanks!

Anthony-Eid pushed a commit to Anthony-Eid/zed that referenced this pull request Nov 22, 2024
Adds more docstring highlights missing from zed-industries#20486.
[PEP257](https://peps.python.org/pep-0257/) defines attribute docstrings
as
> String literals occurring immediately after a simple assignment at the
top level of a module, class, or __init__ method are called “attribute
docstrings”.

This PR adds `@string.doc` for such cases.
Before:

![Screenshot_20241116_162257](https://github.com/user-attachments/assets/6b471cff-717e-4755-9291-d596da927dc6)
After:

![Screenshot_20241116_162457](https://github.com/user-attachments/assets/96674157-9c86-45b6-8ce9-e433ca0ae8ea)

Release Notes:

- Added Python syntax highlighting for attribute docstrings.

---------

Co-authored-by: Piotr Osiewicz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants