From e4f9df9b6e28735452156679806f03c07532fb8f Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Fri, 16 Jan 2026 14:42:55 -0500 Subject: [PATCH] [ty] Truncate imports and qualifications derived from completions This is effectively what's going to happen when we switch to a max-heap for collecting completions. This commit isolates that behavioral change to ensure nothing unexpected happens. (I generally wouldn't expect it to, since that would imply that imports/qualifications care about results beyond the first 1,000.) --- crates/ty_ide/src/completion.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/ty_ide/src/completion.rs b/crates/ty_ide/src/completion.rs index dea8a49509..c2620ae103 100644 --- a/crates/ty_ide/src/completion.rs +++ b/crates/ty_ide/src/completion.rs @@ -132,6 +132,7 @@ impl<'db> Completions<'db> { // Convert this collection into a list of "import..." fixes fn into_imports(mut self) -> Vec { self.items.sort_unstable(); + self.items.truncate(Completions::LIMIT); self.items .into_iter() .map(|CompletionRanker(c)| c) @@ -147,6 +148,7 @@ impl<'db> Completions<'db> { // Convert this collection into a list of "qualify..." fixes fn into_qualifications(mut self, range: TextRange) -> Vec { self.items.sort_unstable(); + self.items.truncate(Completions::LIMIT); self.items .into_iter() .map(|CompletionRanker(c)| c)