settings: Show notification when user/project settings fail to parse (#18122)
Closes #16876 We only ever showed parsing errors, but not if something failed to deserialize. Basically, if you had a stray `,` somewhere, we'd show a notification for user errors, but only squiggly lines if you had a `[]` instead of a `{}`. The squiggly lines would only show up when there were schema errors. In the case of `formatter` settings, for example, if someone put in a `{}` instead of `[]`, we'd never show anything. With this change we always show a notification if parsing user or project settings fails. (Right now, the error message might still be bad, but that's a separate change) Release Notes: - Added a notification to warn users if their user settings or project-local settings failed to deserialize. Demo: https://github.com/user-attachments/assets/e5c48165-f2f7-4b5c-9c6d-6ea74f678683
This commit is contained in:
parent
93730983dd
commit
ace4d5185d
7 changed files with 172 additions and 50 deletions
|
@ -64,7 +64,7 @@ use project::{
|
|||
use remote::{SshConnectionOptions, SshSession};
|
||||
use serde::Deserialize;
|
||||
use session::AppSession;
|
||||
use settings::Settings;
|
||||
use settings::{InvalidSettingsError, Settings};
|
||||
use shared_screen::SharedScreen;
|
||||
use sqlez::{
|
||||
bindable::{Bind, Column, StaticColumnCount},
|
||||
|
@ -832,6 +832,23 @@ impl Workspace {
|
|||
}
|
||||
}
|
||||
|
||||
project::Event::LocalSettingsUpdated(result) => {
|
||||
struct LocalSettingsUpdated;
|
||||
let id = NotificationId::unique::<LocalSettingsUpdated>();
|
||||
|
||||
match result {
|
||||
Err(InvalidSettingsError::LocalSettings { message, path }) => {
|
||||
let full_message =
|
||||
format!("Failed to set local settings in {:?}:\n{}", path, message);
|
||||
this.show_notification(id, cx, |cx| {
|
||||
cx.new_view(|_| MessageNotification::new(full_message.clone()))
|
||||
})
|
||||
}
|
||||
Err(_) => {}
|
||||
Ok(_) => this.dismiss_notification(&id, cx),
|
||||
}
|
||||
}
|
||||
|
||||
project::Event::Notification(message) => {
|
||||
struct ProjectNotification;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue