[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.)
This commit is contained in:
Andrew Gallant
2026-01-16 14:42:55 -05:00
committed by Andrew Gallant
parent 2784461741
commit e4f9df9b6e

View File

@@ -132,6 +132,7 @@ impl<'db> Completions<'db> {
// Convert this collection into a list of "import..." fixes
fn into_imports(mut self) -> Vec<ImportEdit> {
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<ImportEdit> {
self.items.sort_unstable();
self.items.truncate(Completions::LIMIT);
self.items
.into_iter()
.map(|CompletionRanker(c)| c)