From 56a7d246d59d9429304b82bce2f1e71b632c5737 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Sat, 20 Mar 2021 23:04:28 +0200 Subject: Disable unqualified assoc items completion for now --- crates/ide_assists/src/handlers/qualify_path.rs | 1 + crates/ide_completion/src/completions/flyimport.rs | 2 +- crates/ide_db/src/helpers/import_assets.rs | 9 ++++++++- 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() { } #[test] + #[ignore = "FIXME: non-trait assoc items completion is unsupported yet, see FIXME in the import_assets.rs for more details"] fn associated_struct_const_unqualified() { check_assist( 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() { } #[test] - fn local_assoc_items_are_omitted() { + fn unqualified_assoc_items_are_omitted() { check( r#" mod 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( sema, current_crate, path_candidate.name.clone(), - // unqualified assoc items are not valid syntax + // FIXME: we could look up assoc items by the input and propose those in completion, + // but that requries more preparation first: + // * store non-trait assoc items in import_map to fully enable this lookup + // * ensure that does not degrade the performance (bencmark it) + // * write more logic to check for corresponding trait presence requirement (we're unable to flyimport multiple item right now) + // * improve the associated completion item matching and/or scoring to ensure no noisy completions appear + // + // see also an ignored test under FIXME comment in the qualify_path.rs module AssocItemSearch::Exclude, Some(DEFAULT_QUERY_SEARCH_LIMIT), ) -- cgit v1.2.3