mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-15 22:54:00 +00:00
Sort and truncate final response
This commit is contained in:
parent
2ea703c659
commit
064fcfa016
1 changed files with 1 additions and 6 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue