Hello nvim-treesitter team,
The TSStructure documentation states:
hl-TSStructure
This is left as an exercise for the reader.
Interesting. An unloved highlight group, so it seems.
So I did a search for who uses TSStructure and only found one match:
ocaml/highlights.scm
[(module_name) (module_type_name)] @structure
OCaml modules names and nothing else. One of Treesitter's main thrusts is to define and use generic highlight groups across many languages. Special cases have a code-smell about them. TSStructure could be an orphaned highlight group.
It seems plausible to me that OCaml module names could be highlighted via another highlight group such as the upcoming TSNamespace (proposed for C++/Rust) or maybe TSInclude?
I am not too fussed either way; keep as is or eliminate TSStructrure. I just wanted to make folks aware that TSStructure could be eliminated thereby streamlining nvim-treesitter highlight groups a little bit.
Best regards.
Hi, and thanks for the nice explanation, and details about this problem.
TSStructure is indeed left from an old version of the plugin, which, at the beginning reflected the built-in highlight groups from vim itself. I agree though that, in most languages, TSStructure is actually a plain type definition. Now the question is, do we want to use more TSStructure (like in C, C++, Rust ?) or do we want to have everything contained is TSType?
I don't see a need for TSStructure in C, C++ or Rust. The struct keyword should be highlighted as TSKeyword and the name of the struct should be TSType. That's seems reasonable to me.
Note, I did propose a new TSNamespace highlight group for C++ and Rust noted in #516. That will be very useful to highlight C++ std namespace in a unique color (for example).
Overall I believe the current highlight groups, apart from TSStructure, are nearly complete.
Removal is in #518 . Don't know why it was still a draft.
Removal is in #518 . Don't know why it was still a draft.
All in good time. I assume folks are busy.
Most helpful comment
I don't see a need for
TSStructurein C, C++ or Rust. Thestructkeyword should be highlighted asTSKeywordand the name of the struct should beTSType. That's seems reasonable to me.Note, I did propose a new
TSNamespacehighlight group for C++ and Rust noted in #516. That will be very useful to highlight C++stdnamespace in a unique color (for example).Overall I believe the current highlight groups, apart from
TSStructure, are nearly complete.