7945: Future proof completion scores r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
bors[bot] 2021-03-09 17:25:23 +00:00 committed by GitHub
commit 84eed2136b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 96 additions and 72 deletions

View file

@ -213,7 +213,7 @@ pub(crate) fn completion_item(
..Default::default()
};
if item.score().is_some() {
if item.relevance().is_relevant() {
lsp_item.preselect = Some(true);
// HACK: sort preselect items first
lsp_item.sort_text = Some(format!(" {}", item.label()));
@ -1106,7 +1106,9 @@ mod tests {
[
(
"&arg",
None,
Some(
" arg",
),
),
(
"arg",