Skip to content

Commit 4651444

Browse files
Tweak the search limits a bit
1 parent 1598740 commit 4651444

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

crates/completion/src/completions/magic.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,21 @@ use crate::{
1313

1414
use super::Completions;
1515

16+
// TODO kb reuse auto_import assist approach to add trait completion
1617
// TODO kb add a setting toggle for this feature?
1718
pub(crate) fn complete_magic(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> {
1819
if !(ctx.is_trivial_path || ctx.is_pat_binding_or_const) {
1920
return None;
2021
}
22+
let _p = profile::span("complete_magic");
2123
let current_module = ctx.scope.module()?;
2224
let anchor = ctx.name_ref_syntax.as_ref()?;
2325
let import_scope = ImportScope::find_insert_use_container(anchor.syntax(), &ctx.sema)?;
2426

2527
let potential_import_name = ctx.token.to_string();
2628

2729
let possible_imports =
28-
imports_locator::find_similar_imports(&ctx.sema, ctx.krate?, &potential_import_name)
30+
imports_locator::find_similar_imports(&ctx.sema, ctx.krate?, &potential_import_name, 400)
2931
.filter_map(|import_candidate| {
3032
Some(match import_candidate {
3133
Either::Left(module_def) => (

crates/ide_db/src/imports_locator.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,18 @@ pub fn find_similar_imports<'a>(
3535
sema: &Semantics<'a, RootDatabase>,
3636
krate: Crate,
3737
name_to_import: &str,
38+
limit: usize,
3839
) -> impl Iterator<Item = Either<ModuleDef, MacroDef>> {
3940
let _p = profile::span("find_similar_imports");
4041
find_imports(
4142
sema,
4243
krate,
4344
{
4445
let mut local_query = LocalImportablesQuery::new(name_to_import.to_string());
45-
local_query.limit(40);
46+
local_query.limit(limit);
4647
local_query
4748
},
48-
ExternalImportablesQuery::new(name_to_import).limit(40),
49+
ExternalImportablesQuery::new(name_to_import).limit(limit),
4950
)
5051
}
5152

0 commit comments

Comments
 (0)