rust/crates
bors[bot] 989de9e309
Merge #6172
6172: Add qualify path assist r=matklad a=Veykril

This implements a `qualify_path` assist which works quite similar to the `auto_import` assist but instead of adding imports to the file it well, qualifies the path. This PR also moves out the `AutoImportAssets` struct and functions from `auto_import` into a utils submodule as most of this is now shared between `auto_import` and `qualify_path`.

Changes made to `AutoImportAssets` are solely in its `search_for_imports` function which now takes a prefixed parameter to discern between using `find_use_path_prefixed` and `find_use_path` as the former is the required behavior by `auto_import` and the latter by this assist.

For missing imported traits instead of importing this will qualify the path with a trait cast as in:
```rust
test_mod::TestStruct::TEST_CONST<|>
```
becomes
```rust
<test_mod::TestStruct as test_mod::TestTrait>::TEST_CONST
```

and for trait methods ideally it would do the following:
```rust
let test_struct = test_mod::TestStruct {};
test_struct.test_meth<|>od()
```
becomes
```rust
let test_struct = test_mod::TestStruct {};
test_mod::TestTrait::test_method(&test_struct)
```

Fixes #4124.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-10-20 17:03:19 +00:00
..
arena Add TBD description to arena 2020-08-24 13:29:10 +02:00
assists Merge #6172 2020-10-20 17:03:19 +00:00
base_db More type safety around names 2020-10-20 17:09:03 +02:00
call_info Extract call_info and completion into separate crates 2020-10-18 13:09:00 +03:00
cfg Add description for crates that will be published 2020-08-24 13:07:22 +02:00
completion Try to fix publishing 2020-10-19 15:18:28 +02:00
flycheck Bump crossbeam-channel in crates 2020-10-13 16:57:01 +03:00
hir Rename UnconfiguredCode -> InactiveCode 2020-10-20 18:22:31 +02:00
hir_def More detailed message 2020-10-20 18:23:55 +02:00
hir_expand Complete methods when receiver is a macro 2020-10-17 23:43:13 +02:00
hir_ty Add descriptions for diagnostics parseable by xtask 2020-10-19 20:55:16 +03:00
ide Merge #6299 2020-10-20 16:35:05 +00:00
ide_db Clarify the names one more time 2020-10-15 17:38:51 +02:00
mbe Cleanup 2020-10-07 11:55:20 +02:00
parser Rename record_field_pat to record_pat_field 2020-09-10 18:56:04 +02:00
paths Add description for crates that will be published 2020-08-24 13:07:22 +02:00
proc_macro_api Bump crossbeam-channel in crates 2020-10-13 16:57:01 +03:00
proc_macro_srv Add track_env_var to the proc macro server 2020-10-08 17:06:20 +03:00
proc_macro_test Add description for crates that will be published 2020-08-24 13:07:22 +02:00
profile Bump rustc_lexer, cfg-if to 1.0 and add new license to check 2020-10-08 10:39:02 -04:00
project_model Support Display name in project.json 2020-10-20 17:13:15 +02:00
rust-analyzer Simplify diagnostic construction, add unused field 2020-10-20 17:53:04 +02:00
ssr Minor clippy performance suggestions 2020-09-30 15:22:49 -04:00
stdx Add to_upper_snake_case function to stdx 2020-10-12 11:05:00 +03:00
syntax Merge #6172 2020-10-20 17:03:19 +00:00
test_utils Add description for crates that will be published 2020-08-24 13:07:22 +02:00
text_edit Actually assert disjointness 2020-09-03 13:37:36 +02:00
toolchain Add description for crates that will be published 2020-08-24 13:07:22 +02:00
tt Add description for crates that will be published 2020-08-24 13:07:22 +02:00
vfs Rename the method to avoid false promises 2020-09-10 01:45:49 +03:00
vfs-notify Follow symlinks when walking project trees 2020-10-15 14:22:36 -04:00