aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Bulatov <[email protected]>2021-03-20 21:04:28 +0000
committerKirill Bulatov <[email protected]>2021-03-20 21:08:44 +0000
commit56a7d246d59d9429304b82bce2f1e71b632c5737 (patch)
tree9e416f58ada56669dd248a06a566fb47426b3d1b
parent879432452d15d4e9c373a6233a0cd15e22f20ef3 (diff)
Disable unqualified assoc items completion for now
-rw-r--r--crates/ide_assists/src/handlers/qualify_path.rs1
-rw-r--r--crates/ide_completion/src/completions/flyimport.rs2
-rw-r--r--crates/ide_db/src/helpers/import_assets.rs9
3 files changed, 10 insertions, 2 deletions
diff --git a/crates/ide_assists/src/handlers/qualify_path.rs b/crates/ide_assists/src/handlers/qualify_path.rs
index e7444f7db..f91770a76 100644
--- a/crates/ide_assists/src/handlers/qualify_path.rs
+++ b/crates/ide_assists/src/handlers/qualify_path.rs
@@ -536,6 +536,7 @@ fn main() {
536 } 536 }
537 537
538 #[test] 538 #[test]
539 #[ignore = "FIXME: non-trait assoc items completion is unsupported yet, see FIXME in the import_assets.rs for more details"]
539 fn associated_struct_const_unqualified() { 540 fn associated_struct_const_unqualified() {
540 check_assist( 541 check_assist(
541 qualify_path, 542 qualify_path,
diff --git a/crates/ide_completion/src/completions/flyimport.rs b/crates/ide_completion/src/completions/flyimport.rs
index f6c7d507f..eb2cba631 100644
--- a/crates/ide_completion/src/completions/flyimport.rs
+++ b/crates/ide_completion/src/completions/flyimport.rs
@@ -949,7 +949,7 @@ fn main() {
949 } 949 }
950 950
951 #[test] 951 #[test]
952 fn local_assoc_items_are_omitted() { 952 fn unqualified_assoc_items_are_omitted() {
953 check( 953 check(
954 r#" 954 r#"
955mod something { 955mod something {
diff --git a/crates/ide_db/src/helpers/import_assets.rs b/crates/ide_db/src/helpers/import_assets.rs
index 6995c3e19..0da7a1a9d 100644
--- a/crates/ide_db/src/helpers/import_assets.rs
+++ b/crates/ide_db/src/helpers/import_assets.rs
@@ -256,7 +256,14 @@ fn path_applicable_imports(
256 sema, 256 sema,
257 current_crate, 257 current_crate,
258 path_candidate.name.clone(), 258 path_candidate.name.clone(),
259 // unqualified assoc items are not valid syntax 259 // FIXME: we could look up assoc items by the input and propose those in completion,
260 // but that requries more preparation first:
261 // * store non-trait assoc items in import_map to fully enable this lookup
262 // * ensure that does not degrade the performance (bencmark it)
263 // * write more logic to check for corresponding trait presence requirement (we're unable to flyimport multiple item right now)
264 // * improve the associated completion item matching and/or scoring to ensure no noisy completions appear
265 //
266 // see also an ignored test under FIXME comment in the qualify_path.rs module
260 AssocItemSearch::Exclude, 267 AssocItemSearch::Exclude,
261 Some(DEFAULT_QUERY_SEARCH_LIMIT), 268 Some(DEFAULT_QUERY_SEARCH_LIMIT),
262 ) 269 )