mirror of https://github.com/helix-editor/helix
core: Make completion item documentation optional
Path completion items always have documentation but future core (i.e. non-LSP) completions may not always have documentation - for example word completion from the current buffer.pull/12778/head
parent
369f2bb93d
commit
70d452db3e
|
@ -8,7 +8,7 @@ pub struct CompletionItem {
|
||||||
pub label: Cow<'static, str>,
|
pub label: Cow<'static, str>,
|
||||||
pub kind: Cow<'static, str>,
|
pub kind: Cow<'static, str>,
|
||||||
/// Containing Markdown
|
/// Containing Markdown
|
||||||
pub documentation: String,
|
pub documentation: Option<String>,
|
||||||
pub provider: CompletionProvider,
|
pub provider: CompletionProvider,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ pub(crate) fn path_completion(
|
||||||
kind: Cow::Borrowed(kind),
|
kind: Cow::Borrowed(kind),
|
||||||
label: file_name.into(),
|
label: file_name.into(),
|
||||||
transaction,
|
transaction,
|
||||||
documentation,
|
documentation: Some(documentation),
|
||||||
provider: CompletionProvider::Path,
|
provider: CompletionProvider::Path,
|
||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
|
|
|
@ -523,7 +523,10 @@ impl Component for Completion {
|
||||||
None => return,
|
None => return,
|
||||||
},
|
},
|
||||||
CompletionItem::Other(option) => {
|
CompletionItem::Other(option) => {
|
||||||
markdowned(language, None, Some(&option.documentation))
|
let Some(doc) = option.documentation.as_deref() else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
markdowned(language, None, Some(doc))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue