Skip to content

bug: highlight of types prefixed by modules #165

@guimarqu

Description

@guimarqu

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)

No response

Describe the bug

Hi,

I mainly work with Zed and have quite an annoying highlight bug with types prefixed by modules.

I suggested a change in the julia-zed repo to fix the bug in 80% of cases with a full description and examples: JuliaEditorSupport/zed-julia#28 (comment)

I think there is another option to fix the bug. We could change the parser by introducing a new node for "field expression inside types".

For instance instead of having :

variable::MyModule.T
          ---- field expression ----

we could have :

variable::MyModule.T
          ---- scope expression ----

and it would make the highlight query much easier.

I would be very happy to contribute by either :
1- changing the highlight query to capture MyModule as a module and T as a type in the MyModule.T expression (see PR JuliaEditorSupport/zed-julia#28)
2- suggest a change in the parser to capture children of scope_expression as a type and avoid very large capture expressions.

Option 1 is a quick win for 80% of cases but quite verbose.
Option 2 requires more work (I'm not familiar with the tool).

Steps To Reproduce/Bad Parse Tree

This is not a bad parse tree. This is about highlighting.

Expected Behavior/Parse Tree

Capture MyModule.MySubModule.[...].T as a type.

Repro

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    queriesAn issue with queries and not the grammar

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions