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 syntax highlighting missing some cases #10585

Closed
22ispencer opened this issue Apr 24, 2024 · 3 comments · Fixed by #10647
Closed

Python syntax highlighting missing some cases #10585

22ispencer opened this issue Apr 24, 2024 · 3 comments · Fixed by #10647
Labels
C-bug Category: This is a bug

Comments

@22ispencer
Copy link

Summary

I don't know if its possible or not but it appears that there are some cases in which python keywords are not highlighted. In my project i have multiple chained "string" not in data conditions and the not in is appearing as plain text, the same as a variable. I als o did a ternary to check if a value was None and that also was missing highlighting on is not. I've attached a screenshot to show what I'm referencing.

When reproducing it appears that is not is highlighted until the : is added at the end

image

Reproduction Steps

  1. hx example.py
  2. type
data = ["hello", "world"]

if "goodbye" not in data:
    print("oh no!")
  1. observe syntax highlighting

Helix log

log file was too big (647 KB)

Platform

Windows/Linux (WSL 2)

Terminal Emulator

Windows Terminal

Installation Method

pacman

Helix Version

24.3

@22ispencer 22ispencer added the C-bug Category: This is a bug label Apr 24, 2024
@22ispencer
Copy link
Author

python_syntax.log

@benmuth
Copy link

benmuth commented Apr 29, 2024

I'm also having a Python syntax issue. I suspect it's a problem with the tree-sitter grammar, but I'll mention it here anyway.
Quotation marks around strings are broken. There's no matching cursor highlight, and the primary cursor is instead highlighted as if it's the matching cursor. Also, I can't do "Goto matching bracket". You can see in the recording that matching parens work as expected, but quotes don't:
asciicast

If this is an unrelated bug with Helix, I can open a separate issue. Also on 24.3 btw.

@the10thWiz
Copy link
Contributor

I'm pretty sure this is a different issue, and it seems even weirder after trying some things. My first thought was that the issue is related to fstring support, but I tried all the python string variants I could think of, and none of them worked properly. However, triple quoted strings displayed weird behavior - they do allow jumps, just only from the beginning to the end of one of the triple quotes.

"""   """
^ ^

The two highlighted locations are where you can jump between with goto_matching_bracket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants