@@ -851,31 +851,35 @@ pub fn completion(cx: &mut Context) {
851 .timeout(Duration::from_secs(2)),
851 .timeout(Duration::from_secs(2)),
853 .expect("completion failed!")
853 .expect("completion failed!")
854− .expect("completion failed!");
854+ .unwrap_or_default(); // if timeout, just return
856+ // TODO: if no completion, show some message or something
857+ if !res.is_empty() {
858+ let picker = ui::Picker::new(
862+ item.label.as_str().into()
864+ // TODO: use item.filter_text for filtering
866+ |editor: &mut Editor, item| {
867+ // if item.text_edit is Some we use that, else
868+ // let insert_text = &item.insert_text.unwrap_or(item.label);
869+ // and we insert at position.
871+ // merge this with additional_text_edits
856− let picker = ui::Picker::new(
875+ cx.callback = Some(Box::new(
857− res,
876+ move |compositor: &mut Compositor, editor: &mut Editor| {
858− |item| {
877+ compositor.push(Box::new(picker));
860− item.label.as_str().into()
879+ ));
862− // TODO: use item.filter_text for filtering
881+ // TODO!: when iterating over items, show the docs in popup
864− |editor: &mut Editor, item| {
865− // if item.text_edit is Some we use that, else
866− // let insert_text = &item.insert_text.unwrap_or(item.label);
867− // and we insert at position.
869− // merge this with additional_text_edits
873− cx.callback = Some(Box::new(
874− move |compositor: &mut Compositor, editor: &mut Editor| {
875− compositor.push(Box::new(picker));
879− // TODO: when iterating over items, show the docs in popup
880− // language server client needs to be accessible via a registry of some sort
883+ // language server client needs to be accessible via a registry of some sort