How to enable attribute macros to be formatted?

I've noticed that some property macros are highlighted and formatted correctly, but others are not. I tried using syn to parse all the tokens (instead of converting attributes to strings and parsing them myself), but it didn't work.

How can I enable attributes to be formatted?

"Highlighted"? Are we talking about a specific IDE?

What exactly are you doing and how doesn't it work? We need way more context to be able to help.

am using nvim (it using treesitter for highlight, but also support lsp colored) and rustfmt.
highlight is not the most important, I like format more.

Please provide a concrete example. If we are talking about editor experience, what does that have to do with parsing code using syn?

I think this is not an editor issue but a question of how to please rust-analyzer. Because if I use syn to resolve the attribute to Ident, then ra will give completion for ident. Maybe I should go to ra and ask the relevant developers.

I think rust-analyzer looks at how the tokens are used, so if the output uses some tokens as a path to a type, it may get highlited as that kind of type. You need to preserve the spans, though, as far as I know.

The developers of ra tell me that ra attempts to expand macros to provide macro-related completions. Thank you very much.