-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Weird Python highlighting #6730
Comments
It looks like that regex for highlighting constants is too strict: helix/runtime/queries/python/highlights.scm Lines 96 to 97 in 161fef2
The python style guide (here) isn't explicit about it but I think constant names can include digits and could be single-character. So that regex could change to something more permissive like |
A bit if a meta comment but it seems that githubs own syntax highlighting also doesn't highlight |
It looks like the |
Feel free to open a PR here or upstream to copy over any patterns you think would be an improvement. The highlights.scm in a grammar repository are usually just a reference and we do a lot of customization in the |
Summary
The following Python code has very weird highlights:
For some reason, helix seems to have its own set of custom highlights in
runtime/queries/python/highlights.scm
(I'm assuming((identifier) @constant (#match? @constant "^[A-Z_]{2,}$"))
is at least partly responsible for this.Why does helix need such a file though? Shouldn't tree-sitter be enough?
Reproduction Steps
I tried this:
hx /tmp/x.py
I expected this to happen: same color for all identifiers (at least the same for all capitalized ones)
Instead, this happened:
Helix log
~/.cache/helix/helix.log
Platform
Linux
Terminal Emulator
alacritty 0.12.0 (5a728195)
Helix Version
helix 23.03
The text was updated successfully, but these errors were encountered: