Skip to content
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

Hide unhygenic tokens generated by macros from symbol search #17272

Closed
jkelleyrtp opened this issue May 22, 2024 · 3 comments · Fixed by #17282
Closed

Hide unhygenic tokens generated by macros from symbol search #17272

jkelleyrtp opened this issue May 22, 2024 · 3 comments · Fixed by #17282
Labels
A-hygiene A-proc-macro proc macro C-feature Category: feature request

Comments

@jkelleyrtp
Copy link
Contributor

jkelleyrtp commented May 22, 2024

Due to lifetime issues, our macros need to generate a variety of intermediary structs/statics. These show up in symbol search, which clutters up the search significantly. These are technically unhygenic.

I would be happy to fix this with a little bit of guidance.

In this screenshot, I can't actually find the Template struct I'm looking for since the list is filled with the intermediate TEMPLATE object we make in the macro.
Screenshot 2024-05-21 at 5 20 43 PM

It's not just dioxus macros, it's every macro. This is for tracing:
Screenshot 2024-05-21 at 5 28 14 PM

@jkelleyrtp jkelleyrtp added the C-feature Category: feature request label May 22, 2024
@Veykril
Copy link
Member

Veykril commented May 22, 2024

These are technically unhygenic.

They aren't though, they are spanned with call_site meaning they are exposed. def_site would be required to hide these (which a) is obviously still unstable so not an option and b) not honored by this by r-a yet, not that it matters).

So we can't really just hide these away as we'd then actually hide away other constructs that are properly exposed by macros. As for the tracing case we could maybe special case _ prefixes for symbol search and have those be hidden as an escape hatch for def site hygiene being not a thing yet.

@jkelleyrtp
Copy link
Contributor Author

jkelleyrtp commented May 22, 2024

I'd be happy to add a filter for _ or __ - would we want to hide the symbol completely or allow them to show up if there's a specific search for _?

I've already changed our macros to spit out __TEMPLATE - I think that'd be easy for the ecosystem to lightly standardize on.

@Veykril
Copy link
Member

Veykril commented May 22, 2024

or allow them to show up if there's a specific search for _

Would probably be nice to allow that, though I don't know if VSCode will allow us to do that. It is overly strict with the symbol search on the client side in what is allowed to be done and what not unfortunately.

I'd say let's require two underscores then, I imagine some people use a single one for reasons so that's special enough for people to specifically opt-in here until we get def site hygiene.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-hygiene A-proc-macro proc macro C-feature Category: feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants