@@ -92,11 +92,15 @@ impl Completion {
9292
9393 pub fn new(
9494 editor: &Editor,
95− items: Vec<CompletionItem>,
95+ mut items: Vec<CompletionItem>,
9696 offset_encoding: helix_lsp::OffsetEncoding,
9797 start_offset: usize,
9898 trigger_offset: usize,
9999 ) -> Self {
100+ // Sort completion items according to their preselect status (given by the LSP server)
101+ items.sort_by_key(|item| !item.preselect.unwrap_or(false));
102+
103+ // Then create the menu
100104 let menu = Menu::new(items, (), move |editor: &mut Editor, item, event| {
101105 fn item_to_transaction(
102106 doc: &Document,