Fix language config reload logic (#5381)

This commit is contained in:
Ethan Kiang 2023-01-03 21:24:48 +08:00 committed by GitHub
parent a895a4e53a
commit 0dbee9590b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View file

@ -403,6 +403,7 @@ impl Application {
.map_err(|err| anyhow::anyhow!("Failed to load language config: {}", err))?; .map_err(|err| anyhow::anyhow!("Failed to load language config: {}", err))?;
self.syn_loader = std::sync::Arc::new(syntax::Loader::new(syntax_config)); 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() { for document in self.editor.documents.values_mut() {
document.detect_language(self.syn_loader.clone()); document.detect_language(self.syn_loader.clone());
} }
@ -438,8 +439,13 @@ impl Application {
Ok(()) Ok(())
}; };
if let Err(err) = refresh_config() { match refresh_config() {
self.editor.set_error(err.to_string()); Ok(_) => {
self.editor.set_status("Config refreshed");
}
Err(err) => {
self.editor.set_error(err.to_string());
}
} }
} }

View file

@ -1797,7 +1797,7 @@ fn run_shell_command(
let shell = &cx.editor.config().shell; let shell = &cx.editor.config().shell;
let (output, success) = shell_impl(shell, &args.join(" "), None)?; let (output, success) = shell_impl(shell, &args.join(" "), None)?;
if success { if success {
cx.editor.set_status("Command succeed"); cx.editor.set_status("Command succeeded");
} else { } else {
cx.editor.set_error("Command failed"); cx.editor.set_error("Command failed");
} }