mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-07-23 04:35:00 +00:00
feat: completion on func.where and func.with (#204)
This commit is contained in:
parent
b35d897919
commit
b52ad52760
19 changed files with 928 additions and 427 deletions
|
@ -225,28 +225,48 @@ mod tests {
|
|||
match resp {
|
||||
CompletionResponse::List(l) => CompletionResponse::List(CompletionList {
|
||||
is_incomplete: l.is_incomplete,
|
||||
items: l
|
||||
.items
|
||||
.into_iter()
|
||||
.map(|item| CompletionItem {
|
||||
label: item.label,
|
||||
kind: item.kind,
|
||||
text_edit: item.text_edit,
|
||||
..Default::default()
|
||||
})
|
||||
.collect(),
|
||||
items: {
|
||||
let mut res: Vec<_> = l
|
||||
.items
|
||||
.into_iter()
|
||||
.map(|item| CompletionItem {
|
||||
label: item.label,
|
||||
sort_text: item.sort_text,
|
||||
kind: item.kind,
|
||||
text_edit: item.text_edit,
|
||||
..Default::default()
|
||||
})
|
||||
.collect();
|
||||
|
||||
res.sort_by(|a, b| {
|
||||
a.sort_text
|
||||
.as_ref()
|
||||
.cmp(&b.sort_text.as_ref())
|
||||
.then_with(|| a.label.cmp(&b.label))
|
||||
});
|
||||
res
|
||||
},
|
||||
}),
|
||||
CompletionResponse::Array(items) => CompletionResponse::Array(
|
||||
items
|
||||
CompletionResponse::Array(items) => CompletionResponse::Array({
|
||||
let mut res: Vec<_> = items
|
||||
.into_iter()
|
||||
.map(|item| CompletionItem {
|
||||
label: item.label,
|
||||
sort_text: item.sort_text,
|
||||
kind: item.kind,
|
||||
text_edit: item.text_edit,
|
||||
..Default::default()
|
||||
})
|
||||
.collect(),
|
||||
),
|
||||
.collect();
|
||||
|
||||
res.sort_by(|a, b| {
|
||||
a.sort_text
|
||||
.as_ref()
|
||||
.cmp(&b.sort_text.as_ref())
|
||||
.then_with(|| a.label.cmp(&b.label))
|
||||
});
|
||||
res
|
||||
}),
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue