agent: Improve error and warnings display (#36425)

This PR refactors the callout component and improves how we display
errors and warnings in the agent panel, along with improvements for
specific cases (e.g., you have `zed.dev` as your LLM provider and is
signed out).

Still a work in progress, though, wrapping up some details.

Release Notes:

- N/A
This commit is contained in:
Danilo Leal 2025-08-18 21:44:07 -03:00 committed by GitHub
parent b578031120
commit b7edc89a87
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 436 additions and 394 deletions

View file

@ -2021,21 +2021,21 @@ impl RenderOnce for SyntaxHighlightedText {
#[derive(PartialEq)]
struct InputError {
severity: ui::Severity,
severity: Severity,
content: SharedString,
}
impl InputError {
fn warning(message: impl Into<SharedString>) -> Self {
Self {
severity: ui::Severity::Warning,
severity: Severity::Warning,
content: message.into(),
}
}
fn error(message: anyhow::Error) -> Self {
Self {
severity: ui::Severity::Error,
severity: Severity::Error,
content: message.to_string().into(),
}
}
@ -2162,9 +2162,11 @@ impl KeybindingEditorModal {
}
fn set_error(&mut self, error: InputError, cx: &mut Context<Self>) -> bool {
if self.error.as_ref().is_some_and(|old_error| {
old_error.severity == ui::Severity::Warning && *old_error == error
}) {
if self
.error
.as_ref()
.is_some_and(|old_error| old_error.severity == Severity::Warning && *old_error == error)
{
false
} else {
self.error = Some(error);