mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 22:31:43 +00:00
fix: Fix path qualified auto-importing completions not working with re-exports
Prior to this commit we used to generate import paths, then zipped them with the existing qualifier to check if they agree on the path to import. This is brittle when re-exports come into play causing items to have multiple applicable paths that refer to them. This commit instead rewrites this logic by generating the import path for the qualifier, verifying that the rest of the qualifier resolves and then doing a final lookup on that resolution result for the final segment instead.
This commit is contained in:
parent
65c8d1242b
commit
ada5f2059c
9 changed files with 224 additions and 137 deletions
|
@ -3105,10 +3105,10 @@ impl From<ModuleDef> for ItemInNs {
|
|||
}
|
||||
|
||||
impl ItemInNs {
|
||||
pub fn as_module_def(self) -> Option<ModuleDef> {
|
||||
pub fn into_module_def(self) -> ModuleDef {
|
||||
match self {
|
||||
ItemInNs::Types(id) | ItemInNs::Values(id) => Some(id),
|
||||
ItemInNs::Macros(_) => None,
|
||||
ItemInNs::Types(id) | ItemInNs::Values(id) => id,
|
||||
ItemInNs::Macros(id) => ModuleDef::Macro(id),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue