mirror of
https://github.com/astral-sh/ruff
synced 2026-01-21 13:30:49 -05:00
[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:
committed by
Andrew Gallant
parent
2784461741
commit
e4f9df9b6e
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user