-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Syntax highlighting for macros #10281
Comments
Kind of related to #7402; for something like xflags the proc macro would need to provide us with information about the meaning of tokens that are in the macro input but not the output. (Tokens that are passed through to the output should be highlighted according to their meaning there.) Would be pretty cool, but it's a bit far off, I think. (On the other hand, this is something that would take time to permeate through the ecosystem, so it'd benefit from being started early. So if someone really cares about this and would be willing to put in the work, this might be an interesting project.) |
|
I would like to start working on this. Any ideas of how I should start? |
A rough idea would be to leverage #11556 and have proc-macros re-use input tokens that are usually discarded in such helpers attributes so r-a can make use of them for highlighting. |
Is it possible to make it fully automatic, and require the project to not need to manually annotate anything? That issue makes it seem manual. |
There is no way for us to make this automatic for tokens that are not used by the macro. If the macro doesn't use the tokens there is nothing r-a can know about them. Parsing the proc-macro definition is not an option, as that is just rust code. |
Very far-fetch with little logic behind it
Syntax highlighting inside of macros. Something parses the content inside a macro, and theoretically speaking this could be used for syntax highlighting inside of a macro.
For example, take the
xflags
macro. This crate has its own syntactical sugar inside of the macro, and syntax highlighting for it would be cool. Theoretically, it just has to parse how the macro is defined and send that back to the editor, but it is probably more complex than that.Not sure how this would work with proc-macros.
The text was updated successfully, but these errors were encountered: