[go: nahoru, domu]

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

[REQUEST] Highlight version expressions #3003

Open
jordi-torrents opened this issue Jun 21, 2023 · 2 comments
Open

[REQUEST] Highlight version expressions #3003

jordi-torrents opened this issue Jun 21, 2023 · 2 comments

Comments

@jordi-torrents
Copy link

It would be nice to have a highlight for versions (51.4.5 5.1.dev5 0.1.4a3 ...) following PEP 440. Currently these expresions are semi-highlighted as numbers.

An interesting regex for "version" could be something like

([1-9]\d*!)?(0|[1-9]\d*)(\.(0|[1-9]\d*))*((a|b|rc)(0|[1-9]\d*))?(\.post(0|[1-9]\d*))?(\.dev(0|[1-9]\d*))?

The type number should be preferred before version (for example "5.1" is a number). But, then, "5.1.5" should not be detected as a number (not even partially) for type version to detect it. Unfortunately, I don't have much experiance in regex :/

@github-actions
Copy link

Thank you for your issue. Give us a little time to review it.

PS. You might want to check the FAQ if you haven't done so already.

This is an automated reply, generated by FAQtory

@willmcgugan
Copy link
Collaborator

I suspect that would overlap with numbers too much, which is a more common thing to highlight. i.e. is 5.1 a number or a version?

Ultimately though, I'm loathed to add another regex to the default highlighter. Each one slows it down a little. If you need it, its not hard to implement with a custom highlighter.

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

No branches or pull requests

2 participants