rust-analyzer/crates/ide-db/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
..
generated feat: generate descriptors for all unstable features 2023-10-09 09:36:47 +02:00
imports remove unnecessary ast::Path::segments alternatives 2024-01-06 12:53:56 +03:00
syntax_helpers Emit builtin#format_args in builtin format_args expander 2023-09-06 18:08:20 +02:00
test_data Make functions in impl have a container name 2023-12-17 13:44:47 -05:00
tests feat: generate descriptors for all unstable features 2023-10-09 09:36:47 +02:00
active_parameter.rs ⬆️ rust-analyzer 2023-03-13 10:42:24 +02:00
apply_change.rs Make DefDatabase::lang_attr transparent 2024-01-09 20:52:10 +01:00
assists.rs Merge commit 'aa9bc8612514d216f84eec218dfd19ab83f3598a' into sync-from-ra 2023-06-05 12:04:23 +03:00
defs.rs feat: IDE features for primitive tuple fields 2024-01-06 15:04:58 +01:00
documentation.rs Don't trim trailing whitespace from doc comments 2023-12-10 20:54:22 +00:00
famous_defs.rs make generate_mut_trait_impl assist trigged for std trait only 2023-11-05 12:27:10 +08:00
helpers.rs Implicit format args support 2023-12-05 17:07:00 +01:00
items_locator.rs remove redundant clones 2024-01-07 00:17:48 +01:00
label.rs style: rename crates to kebab case 2022-05-01 10:48:58 +00:00
lib.rs Replace SourceRootCrates hashset output with slice for deterministic order 2024-01-10 14:51:51 +01:00
path_transform.rs Auto merge of #16277 - roife:fix-issue16276, r=Veykril 2024-01-09 15:52:34 +00:00
rename.rs feat: IDE features for primitive tuple fields 2024-01-06 15:04:58 +01:00
rust_doc.rs Remove markdown module from rust-analyzer crate 2023-09-02 17:27:52 +02:00
search.rs Auto merge of #16265 - Patryk27:suggest-pub-crate-imports, r=Veykril 2024-01-11 09:54:22 +00:00
source_change.rs remove redundant clones 2024-01-07 00:17:48 +01:00
symbol_index.rs Deduplicate some code 2024-01-05 11:34:18 +01:00
traits.rs internal: Move out WithFixture into dev-dep only crate 2023-12-18 15:24:08 +01:00
ty_filter.rs Run cargo fix --edition-idioms 2022-07-20 15:02:08 +02:00
use_trivial_constructor.rs Merge commit '9b3d03408c66749d56466bb09baf2a7177deb6ce' into sync-from-ra 2023-08-21 12:44:09 +03:00