rust-analyzer/crates/ide-assists/src
bors d5366b5c19 Auto merge of #16265 - Patryk27:suggest-pub-crate-imports, r=Veykril
fix: Acknowledge `pub(crate)` imports in import suggestions

rust-analyzer has logic that discounts suggesting `use`s for private imports, but that logic is unnecessarily strict - for instance given this code:

```rust
mod foo {
    pub struct Foo;
}

pub(crate) use self::foo::*;

mod bar {
    fn main() {
        Foo$0;
    }
}
```

... RA will suggest to add `use crate::foo::Foo;`, which not only makes the code overly verbose (especially in larger code bases), but also is disjoint with what rustc itself suggests.

This commit adjusts the logic, so that `pub(crate)` imports are taken into account when generating the suggestions; considering rustc's behavior, I think this change doesn't warrant any extra configuration flag.

Note that this is my first commit to RA, so I guess the approach taken here might be suboptimal - certainly feels somewhat hacky, maybe there's some better way of finding out the optimal import path 😅
2024-01-11 09:54:22 +00:00
..
handlers Auto merge of #16265 - Patryk27:suggest-pub-crate-imports, r=Veykril 2024-01-11 09:54:22 +00:00
tests Auto merge of #16209 - l1nxy:add-merge-nested-if, r=Veykril 2024-01-10 09:18:05 +00:00
utils Use HashSet to enhance performance in for_unique_generic_name in suggest_name 2024-01-02 21:33:06 +08:00
assist_config.rs Add config for preferring / ignoring prelude modules in find_path 2023-11-11 14:56:38 +01:00
assist_context.rs Import serde derives on converting json to struct 2022-08-06 20:12:21 +04:30
lib.rs complete merge_nested_if with bugs. 2023-12-29 18:32:37 +08:00
tests.rs Auto merge of #16082 - DropDemBits:structured-snippet-migrate-5, r=Veykril 2024-01-02 10:42:16 +00:00
utils.rs fix: use original range to deal with macros in promote_local_to_const 2024-01-02 10:33:48 +01:00