From 064fcfa016e9adac35b07ae6c63e1472c31b1616 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maria=20Jos=C3=A9=20Solano?= Date: Tue, 7 Feb 2023 18:41:28 -0800 Subject: [PATCH] Sort and truncate final response --- crates/rust-analyzer/src/to_proto.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs index f5cee5f907..5bdc1bf8d9 100644 --- a/crates/rust-analyzer/src/to_proto.rs +++ b/crates/rust-analyzer/src/to_proto.rs @@ -216,15 +216,10 @@ pub(crate) fn completion_items( let mut res = Vec::with_capacity(items.len()); for item in items { completion_item(&mut res, config, line_index, &tdpp, max_relevance, item); - - if let Some(limit) = config.completion().limit { - if res.len() >= limit { - break; - } - } } if let Some(limit) = config.completion().limit { + res.sort_by(|item1, item2| item1.sort_text.cmp(&item2.sort_text)); res.truncate(limit); }