completion: Don't panic on timeout/no result, just do nothing.

pull/8/head
Blaž Hrastnik 4 years ago
parent 3cbab20908
commit 6ec0f8e80f

@ -851,8 +851,10 @@ pub fn completion(cx: &mut Context) {
.timeout(Duration::from_secs(2)), .timeout(Duration::from_secs(2)),
) )
.expect("completion failed!") .expect("completion failed!")
.expect("completion failed!"); .unwrap_or_default(); // if timeout, just return
// TODO: if no completion, show some message or something
if !res.is_empty() {
let picker = ui::Picker::new( let picker = ui::Picker::new(
res, res,
|item| { |item| {
@ -876,6 +878,8 @@ pub fn completion(cx: &mut Context) {
}, },
)); ));
// TODO: when iterating over items, show the docs in popup // TODO!: when iterating over items, show the docs in popup
// language server client needs to be accessible via a registry of some sort // language server client needs to be accessible via a registry of some sort
} }
}

Loading…
Cancel
Save