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

Weird syntax highlight issue with Odin language map[string]bool #11520

Open
Akselmo opened this issue Aug 18, 2024 · 4 comments
Open

Weird syntax highlight issue with Odin language map[string]bool #11520

Akselmo opened this issue Aug 18, 2024 · 4 comments
Labels
C-bug Category: This is a bug upstream

Comments

@Akselmo
Copy link
Contributor

Akselmo commented Aug 18, 2024

Summary

Hi, I wasn't exactly sure where to report this, since https://github.com/tree-sitter-grammars/tree-sitter-odin mentioned following:

If your issue is related to a bug in your editor-experience because your editor leverages tree-sitter and this parser, then it is likely your issue does NOT belong here and belongs in the relevant editor's repository.

The bug

If I create a map with strings as keys, the coloring seems to get confused.

Best shown with a screenshot:

image

The first line, MOVE_FRONT, is correct. Any subsequent lines look wrong.

Tree-sitter scopes seem to error out?

image

image

Reproduction Steps

I tried this:

  1. hx
  2. Paste following snippet
package test
import rl "vendor:raylib"

WeirdMap := map[string]bool \
{
	"MOVE_FRONT" = rl.IsKeyDown(cast(rl.KeyboardKey)settings.Values.keyMoveForward),
	"MOVE_BACK"  = rl.IsKeyDown(cast(rl.KeyboardKey)settings.Values.keyMoveBackward),
	"MOVE_RIGHT" = rl.IsKeyDown(cast(rl.KeyboardKey)settings.Values.keyMoveRight),
	"MOVE_LEFT"  = rl.IsKeyDown(cast(rl.KeyboardKey)settings.Values.keyMoveLeft),
}

I expected this to happen:
Syntax highlighting for string would be correct, like on the first line.

Instead, this happened:
Seems helix thinks for some reason that the next line with MOVE_BACK with the first " is not start of string?

Helix log

~/.cache/helix/helix.log
please provide a copy of `~/.cache/helix/helix.log` here if possible, you may need to redact some of the lines

Platform

Linux

Terminal Emulator

konsole 24.11.70

Installation Method

fedora packages

Helix Version

helix 24.7 (079f544)

@Akselmo Akselmo added the C-bug Category: This is a bug label Aug 18, 2024
@archseer
Copy link
Member

No, this is definitely a parsing issue that has to be fixed by the grammar upstream. (I also can't find that quote anywhere)

@Akselmo
Copy link
Contributor Author

Akselmo commented Aug 19, 2024

I saw the quote when making a bug report. Anyhow, thanks for clarification, will make a bug upstream :)

@leo-unglaub
Copy link

Just for reference, this is not just linked to the odin language. This happens also in php and other languages, most of the time if the letter M is involved.

Screenshot from 2024-08-21 12-56-43

@the-mikedavis
Copy link
Member

That's unrelated - it's because the k is lowercase so it's not highlighted as a constant. That's up to php's queries in runtime/queries/php/highlights.scm

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 upstream
Projects
None yet
Development

No branches or pull requests

5 participants