From 0dbee9590baed10bef3c6c32420b8a5802204657 Mon Sep 17 00:00:00 2001 From: Ethan Kiang Date: Tue, 3 Jan 2023 21:24:48 +0800 Subject: [PATCH] Fix language config reload logic (#5381) --- helix-term/src/application.rs | 10 ++++++++-- helix-term/src/commands/typed.rs | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index 83e853b1..729047e3 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -403,6 +403,7 @@ impl Application { .map_err(|err| anyhow::anyhow!("Failed to load language config: {}", err))?; self.syn_loader = std::sync::Arc::new(syntax::Loader::new(syntax_config)); + self.editor.syn_loader = self.syn_loader.clone(); for document in self.editor.documents.values_mut() { document.detect_language(self.syn_loader.clone()); } @@ -438,8 +439,13 @@ impl Application { Ok(()) }; - if let Err(err) = refresh_config() { - self.editor.set_error(err.to_string()); + match refresh_config() { + Ok(_) => { + self.editor.set_status("Config refreshed"); + } + Err(err) => { + self.editor.set_error(err.to_string()); + } } } diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 5c0cd654..de24c4fb 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -1797,7 +1797,7 @@ fn run_shell_command( let shell = &cx.editor.config().shell; let (output, success) = shell_impl(shell, &args.join(" "), None)?; if success { - cx.editor.set_status("Command succeed"); + cx.editor.set_status("Command succeeded"); } else { cx.editor.set_error("Command failed"); }