@@ -60,14 +60,19 @@ impl Application {
60 std::sync::Arc::new(theme::Loader::new(&conf_dir, &helix_core::runtime_dir()));
60 std::sync::Arc::new(theme::Loader::new(&conf_dir, &helix_core::runtime_dir()));
62 // load default and user config, and merge both
62 // load default and user config, and merge both
63− let def_lang_conf: toml::Value = toml::from_slice(include_bytes!("../../languages.toml"))
63+ let builtin_err_msg =
64− .expect("Could not parse built-in languages.toml, something must be very wrong");
64+ "Could not parse built-in languages.toml, something must be very wrong";
65+ let def_lang_conf: toml::Value =
66+ toml::from_slice(include_bytes!("../../languages.toml")).expect(builtin_err_msg);
67+ let def_syn_loader_conf: helix_core::syntax::Configuration =
68+ def_lang_conf.clone().try_into().expect(builtin_err_msg);
65− let user_lang_conf: Option<toml::Value> = std::fs::read(conf_dir.join("languages.toml"))
69+ let user_lang_conf = std::fs::read(conf_dir.join("languages.toml"))
67− .map(|raw| toml::from_slice(&raw).expect("Could not parse user languages.toml"));
71+ .map(|raw| toml::from_slice(&raw));
68 let lang_conf = match user_lang_conf {
72 let lang_conf = match user_lang_conf {
69− Some(value) => merge_toml_values(def_lang_conf, value),
73+ Some(Ok(value)) => Ok(merge_toml_values(def_lang_conf, value)),
74+ Some(err @ Err(_)) => err,
70− None => def_lang_conf,
75+ None => Ok(def_lang_conf),
73 let theme = if let Some(theme) = &config.theme {
78 let theme = if let Some(theme) = &config.theme {
@@ -83,8 +88,15 @@ impl Application {
85 let syn_loader_conf: helix_core::syntax::Configuration = lang_conf
90 let syn_loader_conf: helix_core::syntax::Configuration = lang_conf
86− .try_into()
91+ .and_then(|conf| conf.try_into())
87− .expect("Could not parse merged (built-in + user) languages.toml");
92+ .unwrap_or_else(|err| {
93+ eprintln!("Bad language config: {}", err);
94+ eprintln!("Press <ENTER> to continue with default language config");
96+ // This waits for an enter press.
97+ let _ = std::io::stdin().read(&mut []);
88 let syn_loader = std::sync::Arc::new(syntax::Loader::new(syn_loader_conf));
100 let syn_loader = std::sync::Arc::new(syntax::Loader::new(syn_loader_conf));
90 let mut editor = Editor::new(
102 let mut editor = Editor::new(