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

bug: highlight of types prefixed by modules #165

Open
1 of 2 tasks
guimarqu opened this issue Dec 29, 2024 · 1 comment
Open
1 of 2 tasks

bug: highlight of types prefixed by modules #165

guimarqu opened this issue Dec 29, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@guimarqu
Copy link

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

@guimarqu guimarqu added the bug Something isn't working label Dec 29, 2024
@guimarqu
Copy link
Author

We could use scoped_identifier instead of introducing a new node.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant