Skip to content

bug: Unitful.jl macros break syntax highlighting when applied outside of brackets #160

@Jarrod-Angove

Description

@Jarrod-Angove

Did you check existing issues?

  • I have read all the tree-sitter docs if it relates to using the parser
  • I have searched the existing issues of tree-sitter-julia

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

tree-sitter 0.23.2

Describe the bug

Writing a vector or bracketed operation using the unitful u"unit" macro prevents parsing of subsequent lines. Inserting a multiplication operator between the bracket and the macro fixes the issue.

With multiplication operator:
image

Without:
image

Steps To Reproduce/Bad Parse Tree

The bug appears when the unit macro is applied in two subsequent lines. i.e.

R = [10, 20, 30, 40]u"m"
R0 = 50
# everything past here still has syntax highlighting
#...

Whereas

R = [10, 20, 30, 40]u"m"
R0 = [50, 60, 70, 80]u"m"
# everything past here has the same highlight group as regular variables (white in my case)

Expected Behavior/Parse Tree

R = [10, 20, 30, 40]u"m"
R0 = [50, 60, 70, 80]u"m"
...
# Everything still has syntax highlighting

Repro

R0 = [10, 20, 30, 40]u"m"
R1 = [1, 2, 3, 4]u"m"
println("example")

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions