gdamore / tree-sitter-d

D Grammar for Tree Sitter
MIT License
41 stars 7 forks source link

Bad type highlighting in helix #21

Open MightyPrinny opened 10 months ago

MightyPrinny commented 10 months ago

The problem User types aren't highlighted in the helix editor with the current highlights.scm

To Reproduce Open d file in helix.

Expected behavior User defined types should be highlighted as types

Fix As a workaround I made these changes to the highlights.scm for helix where @function was used

(call_expression (identifier) @function)
(call_expression (type (identifier) @function))
(call_expression (type (template_instance (identifier) @function)))
(call_expression (type (template_instance (template_arguments (identifier) @type))))
(type (identifier) @type)

I don't understand how tree sitter or the highlighting system works so I'm posting it so you can decide if it's good enough for now, the highlighting in general isn't as rich as in other languages, but for me personally this is one of the most important things to have highlighted.

gdamore commented 5 months ago

I've made some changes to the main highlights.scm. I'm not using Helix right now, so I can't easily assess if those changes are good or not.

gdamore commented 1 month ago

@MightyPrinny can you tell me if the changes in the highlights.scm are good? I don't maintain the helix plugin.

MightyPrinny commented 1 month ago

I don't think so, I tried the current highlights.scm (https://raw.githubusercontent.com/gdamore/tree-sitter-d/main/queries/highlights.scm) in neovim and now functions look like types and types aren't highlighted in pointer declarations.

gdamore commented 1 month ago

I'm not sure if neovim's queries are compatible... I need to look into this.