Highlight struct/enum/union keywords using @structure
ebkalderon opened this issue · comments
According to this resource, the Structure
highlight group is meant to highlight keywords such as struct
, enum
, union
, etc. By default, the @structure
highlight group in nvim-treesitter
links to Structure
. As such, this parser should highlight the struct
, enum
, and union
keywords using @structure
instead of @keyword
.
This change would enable third-party color schemes to highlight this keyword separately from other Rust keywords. For example, see this screenshot of Monokai in Sublime Text 4 doing just that.
wrong repo
Hello there, @amaanq! Would you mind clarifying a little what you mean? The request described above is to change the highlights.scm
query script provided with tree-sitter-rust
to emit the @structure
highlight when the keywords struct
, enum
, and union
are encountered, rather than emitting @keyword
, as is currently done. This would increase the flexibility of downstream projects depending on tree-sitter-rust
for highlighting. Is this understanding not accurate?
Sorry to ping directly again, @amaanq, but I was wondering if you might be able to clarify why this issue is outside the scope of this repository? I understand that this repo contains the highlights.scm
file which defines the highlight queries and TS groups, correct? Thanks again.
Sorry, just seeing this again after cleaning my issues - it belongs in the tool that you use for highlighting, I am not sure what your screenshot is from but it's definitely not tree-sitter cli output, so file an issue there
I know it's been a while since I last opened this issue, but I have no clue what I was thinking when I first wrote the issue description. I think I misunderstood what purpose tree-sitter-rust
served in relation to nvim-treesitter
and how queries in TS work in general. Sorry about that!
I have since opened a separate issue on the nvim-treesitter
repo instead with a hopefully clearer explanation of what I was originally looking for: nvim-treesitter/nvim-treesitter#6205