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: Decorator support #1639

Merged
merged 5 commits into from
Dec 1, 2018
Merged

Conversation

RunDevelopment
Copy link
Member

@RunDevelopment RunDevelopment commented Nov 29, 2018

This PR adds support for Python decorators implementing #1635 using the solution proposed by @spectras.

I also added 2 aliases: annotation to be like Java and punctuation to change the actual color (like Java).

This resolves #1635.

Copy link

@sardmhmd sardmhmd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to leave a comment indicating the requested changes.

@sardmhmd
Copy link

You need to leave a comment indicating the requested changes.

@@ -0,0 +1,28 @@
@some.decorator(foobar)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to highlight the whole line as a decorator or just the @ symbol? How do other highlighters do it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I err towards highlighting @some.decorator as Notepad++ and VS both do.
(VS Code doesn't highlight anything)

@mAAdhaTTah mAAdhaTTah merged commit 2577b6e into PrismJS:master Dec 1, 2018
@RunDevelopment RunDevelopment deleted the python-decorator branch December 2, 2018 08:49
@spectras
Copy link

spectras commented Dec 4, 2018

Wow that was quick.
Just a short comment to thank all for the amazing work. 👍

ggrossetie pushed a commit to ggrossetie/prism that referenced this pull request Mar 11, 2019
Add support for Python decorators, implementing PrismJS#1635
using the solution proposed by @spectras.

Also add 2 aliases: `annotation` to be like Java and `punctuation`
to change the actual color (like Java).

This resolves PrismJS#1635.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Python - add decorator detection
4 participants