tree-sitter-grammars / tree-sitter-odin

Odin grammar for tree-sitter
MIT License
17 stars 4 forks source link

bug: Weird syntax highlight issue with Odin language map[string]bool #18

Open Akselmo opened 1 month ago

Akselmo commented 1 month ago

Did you check existing issues?

Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)

No response

Describe the bug

Hey, I first created this bug to Helix issue tracker but I was told to report it here.

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

Steps To Reproduce/Bad Parse Tree

  1. Easiest way to find out this bug was using helix editor
  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), }



### Expected Behavior/Parse Tree

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

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

### Repro

_No response_