mirror of
https://github.com/denoland/deno.git
synced 2025-01-21 21:50:00 -05:00
feat(cli/lsp): Sort repl completions (#15171)
This commit is contained in:
parent
3a4e95c431
commit
61340f1d89
1 changed files with 8 additions and 1 deletions
|
@ -145,11 +145,18 @@ impl ReplLanguageServer {
|
|||
.ok()
|
||||
.unwrap_or_default();
|
||||
|
||||
let items = match response {
|
||||
let mut items = match response {
|
||||
Some(CompletionResponse::Array(items)) => items,
|
||||
Some(CompletionResponse::List(list)) => list.items,
|
||||
None => Vec::new(),
|
||||
};
|
||||
items.sort_by_key(|item| {
|
||||
if let Some(sort_text) = &item.sort_text {
|
||||
sort_text.clone()
|
||||
} else {
|
||||
item.label.clone()
|
||||
}
|
||||
});
|
||||
items
|
||||
.into_iter()
|
||||
.filter_map(|item| {
|
||||
|
|
Loading…
Add table
Reference in a new issue