diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-21 09:37:08 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-21 09:37:08 +0000 |
commit | 09412d85fc3137d6ada3b27170e14c287f1a1191 (patch) | |
tree | ac01ec54df0cebba975c82008482319820ce8757 /crates/ide_completion/src/completions | |
parent | 2280f62a40f31d83fd79b62c46dd3d610354d78c (diff) | |
parent | 56a7d246d59d9429304b82bce2f1e71b632c5737 (diff) |
Merge #8123
8123: Do not display unqualified assoc item completions r=SomeoneToIgnore a=SomeoneToIgnore
Part of https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/autoimport.20weirdness
Removes all flyimport completions for any unqualified associated type, effectively reverting https://github.com/rust-analyzer/rust-analyzer/pull/8095
I've explained the reasoning in the corresponding FIXME and open to discussions.
As an alternative way, we could add yet another parameter in the method that's used by the `qualify_path` and enable it for the qualify assists only.
Co-authored-by: Kirill Bulatov <[email protected]>
Diffstat (limited to 'crates/ide_completion/src/completions')
-rw-r--r-- | crates/ide_completion/src/completions/flyimport.rs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/crates/ide_completion/src/completions/flyimport.rs b/crates/ide_completion/src/completions/flyimport.rs index 08df2df3f..eb2cba631 100644 --- a/crates/ide_completion/src/completions/flyimport.rs +++ b/crates/ide_completion/src/completions/flyimport.rs | |||
@@ -947,4 +947,36 @@ fn main() { | |||
947 | expect![[]], | 947 | expect![[]], |
948 | ) | 948 | ) |
949 | } | 949 | } |
950 | |||
951 | #[test] | ||
952 | fn unqualified_assoc_items_are_omitted() { | ||
953 | check( | ||
954 | r#" | ||
955 | mod something { | ||
956 | pub trait BaseTrait { | ||
957 | fn test_function() -> i32; | ||
958 | } | ||
959 | |||
960 | pub struct Item1; | ||
961 | pub struct Item2; | ||
962 | |||
963 | impl BaseTrait for Item1 { | ||
964 | fn test_function() -> i32 { | ||
965 | 1 | ||
966 | } | ||
967 | } | ||
968 | |||
969 | impl BaseTrait for Item2 { | ||
970 | fn test_function() -> i32 { | ||
971 | 2 | ||
972 | } | ||
973 | } | ||
974 | } | ||
975 | |||
976 | fn main() { | ||
977 | test_f$0 | ||
978 | }"#, | ||
979 | expect![[]], | ||
980 | ) | ||
981 | } | ||
950 | } | 982 | } |