-
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
Proper support for import aliases and attributes on imports #14079
Comments
Add ExternCrateDecl to HIR Adding these doesn't really require much design effort as they represent a single import, unlike use trees which are one item that represent 0 or more imports. We only resolve to this definition when actually resolving on the name or alias of an `extern crate name as alias` item, not usages yet as that requires far more changes that won't lead anywhere without giving it more thought. Nevertheless the changes slightly improve IDE things, an example being hover on the decl showing the merged doc comments for example. cc #14079
Name change Import to Use in hir-def, add unused placeholder variants for UseId cc #14079
internal: Record import source IDs cc #14079
internal: Record import origins in ItemScope and PerNS This records the import items definitions come from in the module scope (as well as what an import resolves to in an ItemScope). It does ignore glob imports as thats a lot more work for little to no gain, glob imports act as if the importing items are "inlined" into the scope which suffices for almost all use cases I believe (to my knowledge, attributes on them have little effect). There is still a lot of work needed to make this available to the IDE layer, but this lays out the ground work for havin IDE layer support. cc #14079
So, what's roughly missing here to finish this issue up is the following: Our Name{Ref} "classification" needs to be changed to accomodate for imports and extern crate declarations. I am unsure of the interface we want here, we might just want to have two APIs, one that returns Then we just need to adjust all the IDE features that would want to care about the imports in that regard. For that we need to implement a way to step through the import chain. We already have a function to fully re-resolve an import here
Stepping through resolutions requires more effort though due to proper namespace handling and exposing a decent API for that in the IDE layer. Part of the task would be figuring that out. |
We currently don't really support aliasing imports at all (aliases usually just break things or make them not work at all), likewise we kind of ignore most attributes on imports, like
#[doc(hidden)]
and similar things. We should make these work, though it's not clear how to tackle this.some issues depending on this:
Deref
suggestinglazy_static::__Deref
instead ofstd::ops::Deref
#9197The text was updated successfully, but these errors were encountered: