aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Bulatov <[email protected]>2021-01-04 20:01:35 +0000
committerKirill Bulatov <[email protected]>2021-01-04 20:01:35 +0000
commit27b3b13824f223b69558c84de264267bd3fee9c2 (patch)
treef9ca09fd38ef52ebb39b2586304a72df371ca6eb
parentca42a52051e69d441b3f32ba4268286a8f0d8685 (diff)
Small helpers
-rw-r--r--crates/completion/src/completions/unqualified_path.rs2
-rw-r--r--crates/hir_def/src/import_map.rs4
2 files changed, 5 insertions, 1 deletions
diff --git a/crates/completion/src/completions/unqualified_path.rs b/crates/completion/src/completions/unqualified_path.rs
index f376ded57..2f41a3f96 100644
--- a/crates/completion/src/completions/unqualified_path.rs
+++ b/crates/completion/src/completions/unqualified_path.rs
@@ -124,8 +124,8 @@ fn complete_enum_variants(acc: &mut Completions, ctx: &CompletionContext, ty: &T
124// Note that having this flag set to `true` does not guarantee that the feature is enabled: your client needs to have the corredponding 124// Note that having this flag set to `true` does not guarantee that the feature is enabled: your client needs to have the corredponding
125// capability enabled. 125// capability enabled.
126fn fuzzy_completion(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> { 126fn fuzzy_completion(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> {
127 let _p = profile::span("fuzzy_completion");
128 let potential_import_name = ctx.token.to_string(); 127 let potential_import_name = ctx.token.to_string();
128 let _p = profile::span("fuzzy_completion").detail(|| potential_import_name.clone());
129 129
130 if potential_import_name.len() < 2 { 130 if potential_import_name.len() < 2 {
131 return None; 131 return None;
diff --git a/crates/hir_def/src/import_map.rs b/crates/hir_def/src/import_map.rs
index 1325a93d1..59206cab8 100644
--- a/crates/hir_def/src/import_map.rs
+++ b/crates/hir_def/src/import_map.rs
@@ -8,6 +8,7 @@ use hir_expand::name::Name;
8use indexmap::{map::Entry, IndexMap}; 8use indexmap::{map::Entry, IndexMap};
9use itertools::Itertools; 9use itertools::Itertools;
10use rustc_hash::{FxHashSet, FxHasher}; 10use rustc_hash::{FxHashSet, FxHasher};
11use test_utils::mark;
11 12
12use crate::{ 13use crate::{
13 db::DefDatabase, item_scope::ItemInNs, visibility::Visibility, AssocItemId, ModuleDefId, 14 db::DefDatabase, item_scope::ItemInNs, visibility::Visibility, AssocItemId, ModuleDefId,
@@ -185,6 +186,7 @@ impl ImportMap {
185 is_type_in_ns: bool, 186 is_type_in_ns: bool,
186 original_import_info: &ImportInfo, 187 original_import_info: &ImportInfo,
187 ) { 188 ) {
189 mark::hit!(type_aliases_ignored);
188 for (assoc_item_name, item) in &db.trait_data(tr).items { 190 for (assoc_item_name, item) in &db.trait_data(tr).items {
189 let module_def_id = match item { 191 let module_def_id = match item {
190 AssocItemId::FunctionId(f) => ModuleDefId::from(*f), 192 AssocItemId::FunctionId(f) => ModuleDefId::from(*f),
@@ -442,6 +444,7 @@ fn item_import_kind(item: ItemInNs) -> Option<ImportKind> {
442mod tests { 444mod tests {
443 use base_db::{fixture::WithFixture, SourceDatabase, Upcast}; 445 use base_db::{fixture::WithFixture, SourceDatabase, Upcast};
444 use expect_test::{expect, Expect}; 446 use expect_test::{expect, Expect};
447 use test_utils::mark;
445 448
446 use crate::{test_db::TestDB, AssocContainerId, Lookup}; 449 use crate::{test_db::TestDB, AssocContainerId, Lookup};
447 450
@@ -779,6 +782,7 @@ mod tests {
779 782
780 #[test] 783 #[test]
781 fn fuzzy_import_trait_and_assoc_items() { 784 fn fuzzy_import_trait_and_assoc_items() {
785 mark::check!(type_aliases_ignored);
782 let ra_fixture = r#" 786 let ra_fixture = r#"
783 //- /main.rs crate:main deps:dep 787 //- /main.rs crate:main deps:dep
784 //- /dep.rs crate:dep 788 //- /dep.rs crate:dep