Closed lmburns closed 1 year ago
@aryx This looks to me like the intended effect of #93? #[serde()]
is not a built-in macro, so #93 causes tree-sitter to parse it as an attr_item
rather than a meta_item
, which, being a new node type, is presumably not highlighted (I'm not at all familiar with how syntax highlighting with tree-sitter works, sorry).
Avoiding this kind of breaking change while supporting non-meta-item attributes would probably require a different approach than #93, probably using injections as @resolritter suggested in https://github.com/tree-sitter/tree-sitter-rust/pull/93#issuecomment-747863610.
It's not highlighted because highlights.scm needs to be updated to take into account the new attr_item construct?
Maybe? I don't see anything in highlights.scm
(nor in the other queries) that looks like it handles the internal structure of attributes at all. There's just:
(attribute_item) @attribute
(inner_attribute_item) @attribute
Are there any tests for syntax highlighting, or an example of how best to write such tests?
I'm unsure when this happened in the commits, I have treesitter update everyday, so I believe it has been since last night. I'm also unsure if this has to do with this repo or the main treesitter repo. However, attribute-macros no longer highlight with my code.
#[derive(...)]
does, but#[serde(...)]
does not.The highlight group under
#[derive(...)]
is the following:The highlight group under
#[serde(...)]
is the following:Picture to show an example:![Alacritty_2022-03-11_19-54](https://user-images.githubusercontent.com/44355502/157999523-d0c46545-722b-464a-a95b-8473da0f3c22.png)