project: Set completion to undocumented if text empty (#11207)

I think the previous code was missing a `return` in there because it
always overwrote the `completion.documentation` field, even if the
`text.is_empty()` is true.

Release Notes:

- N/A
This commit is contained in:
Thorsten Ball 2024-04-30 14:56:22 +02:00 committed by GitHub
parent f96cab286c
commit 73d0600ad2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5723,13 +5723,9 @@ impl Project {
return;
};
if response.text.is_empty() {
let mut completions = completions.write();
let completion = &mut completions[completion_index];
completion.documentation = Some(Documentation::Undocumented);
}
let documentation = if response.is_markdown {
let documentation = if response.text.is_empty() {
Documentation::Undocumented
} else if response.is_markdown {
Documentation::MultiLineMarkdown(
markdown::parse_markdown(&response.text, &language_registry, None).await,
)