Show inline documentation in menu even if documentation is disabled (#22137)
This makes inline completions show up in the completion menu even if the user has set `"show_completion_documentation": false` in their settings, because there is no other way to show the Zeta completion. Follow-up to #22093 Release Notes: - N/A Co-authored-by: Danilo <danilo@zed.dev>
This commit is contained in:
parent
3978937457
commit
228c89a78a
1 changed files with 17 additions and 18 deletions
|
@ -401,9 +401,9 @@ impl CompletionsMenu {
|
||||||
let selected_item = self.selected_item;
|
let selected_item = self.selected_item;
|
||||||
let style = style.clone();
|
let style = style.clone();
|
||||||
|
|
||||||
let multiline_docs = if show_completion_documentation {
|
let multiline_docs = match &self.entries[selected_item] {
|
||||||
match &self.entries[selected_item] {
|
CompletionEntry::Match(mat) if show_completion_documentation => {
|
||||||
CompletionEntry::Match(mat) => match &completions[mat.candidate_id].documentation {
|
match &completions[mat.candidate_id].documentation {
|
||||||
Some(Documentation::MultiLinePlainText(text)) => {
|
Some(Documentation::MultiLinePlainText(text)) => {
|
||||||
Some(div().child(SharedString::from(text.clone())))
|
Some(div().child(SharedString::from(text.clone())))
|
||||||
}
|
}
|
||||||
|
@ -420,7 +420,8 @@ impl CompletionsMenu {
|
||||||
Some(div().child("No documentation"))
|
Some(div().child("No documentation"))
|
||||||
}
|
}
|
||||||
_ => None,
|
_ => None,
|
||||||
},
|
}
|
||||||
|
}
|
||||||
CompletionEntry::InlineCompletionHint(hint) => Some(match &hint.text {
|
CompletionEntry::InlineCompletionHint(hint) => Some(match &hint.text {
|
||||||
InlineCompletionText::Edit { text, highlights } => div()
|
InlineCompletionText::Edit { text, highlights } => div()
|
||||||
.my_1()
|
.my_1()
|
||||||
|
@ -432,14 +433,12 @@ impl CompletionsMenu {
|
||||||
),
|
),
|
||||||
InlineCompletionText::Move(text) => div().child(text.clone()),
|
InlineCompletionText::Move(text) => div().child(text.clone()),
|
||||||
}),
|
}),
|
||||||
}
|
_ => None,
|
||||||
} else {
|
|
||||||
None
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let aside_contents = if let Some(multiline_docs) = multiline_docs {
|
let aside_contents = if let Some(multiline_docs) = multiline_docs {
|
||||||
Some(multiline_docs)
|
Some(multiline_docs)
|
||||||
} else if self.aside_was_displayed.get() {
|
} else if show_completion_documentation && self.aside_was_displayed.get() {
|
||||||
Some(div().child("Fetching documentation..."))
|
Some(div().child("Fetching documentation..."))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue