keymap: Show error notification when keymap is invalid (#15977)

This adds an error notification that pops up when the user has an
invalid keymap, similar to what we added for settings in #15905.

Release Notes:

- Added a popup that is displayed when the keymap is invalid
This commit is contained in:
Bennet Bo Fenner 2024-08-08 14:11:46 +02:00 committed by GitHub
parent 92496f33e7
commit 793cd88792
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 43 additions and 14 deletions

View file

@ -1,5 +1,4 @@
use crate::{settings_store::SettingsStore, Settings};
use anyhow::Result;
use fs::Fs;
use futures::{channel::mpsc, StreamExt};
use gpui::{AppContext, BackgroundExecutor, ReadGlobal, UpdateGlobal};
@ -67,7 +66,7 @@ pub fn watch_config_file(
pub fn handle_settings_file_changes(
mut user_settings_file_rx: mpsc::UnboundedReceiver<String>,
cx: &mut AppContext,
settings_changed: impl Fn(Result<()>, &mut AppContext) + 'static,
settings_changed: impl Fn(Option<anyhow::Error>, &mut AppContext) + 'static,
) {
let user_settings_content = cx
.background_executor()
@ -85,7 +84,7 @@ pub fn handle_settings_file_changes(
if let Err(err) = &result {
log::error!("Failed to load user settings: {err}");
}
settings_changed(result, cx);
settings_changed(result.err(), cx);
cx.refresh();
});
if result.is_err() {