Limit number of completions
This commit is contained in:
parent
ec89fc85a8
commit
d5fb7a4ba4
1 changed files with 12 additions and 1 deletions
|
|
@ -215,8 +215,19 @@ pub(crate) fn completion_items(
|
|||
let max_relevance = items.iter().map(|it| it.relevance().score()).max().unwrap_or_default();
|
||||
let mut res = Vec::with_capacity(items.len());
|
||||
for item in items {
|
||||
completion_item(&mut res, config, line_index, &tdpp, max_relevance, item)
|
||||
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.truncate(limit);
|
||||
}
|
||||
|
||||
res
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue