@@ -60,14 +60,19 @@ impl Application {
6060 std::sync::Arc::new(theme::Loader::new(&conf_dir, &helix_core::runtime_dir()));
6161
6262 // load default and user config, and merge both
63− let def_lang_conf: toml::Value = toml::from_slice(include_bytes!("../../languages.toml"))
64− .expect("Could not parse built-in languages.toml, something must be very wrong");
65− let user_lang_conf: Option<toml::Value> = std::fs::read(conf_dir.join("languages.toml"))
63+ let builtin_err_msg =
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);
69+ let user_lang_conf = std::fs::read(conf_dir.join("languages.toml"))
6670 .ok()
67− .map(|raw| toml::from_slice(&raw).expect("Could not parse user languages.toml"));
71+ .map(|raw| toml::from_slice(&raw));
6872 let lang_conf = match user_lang_conf {
69− Some(value) => merge_toml_values(def_lang_conf, value),
70− None => def_lang_conf,
73+ Some(Ok(value)) => Ok(merge_toml_values(def_lang_conf, value)),
74+ Some(err @ Err(_)) => err,
75+ None => Ok(def_lang_conf),
7176 };
7277
7378 let theme = if let Some(theme) = &config.theme {
@@ -83,8 +88,15 @@ impl Application {
8388 };
8489
8590 let syn_loader_conf: helix_core::syntax::Configuration = lang_conf
86− .try_into()
87− .expect("Could not parse merged (built-in + user) languages.toml");
91+ .and_then(|conf| conf.try_into())
92+ .unwrap_or_else(|err| {
93+ eprintln!("Bad language config: {}", err);
94+ eprintln!("Press <ENTER> to continue with default language config");
95+ use std::io::Read;
96+ // This waits for an enter press.
97+ let _ = std::io::stdin().read(&mut []);
98+ def_syn_loader_conf
99+ });
88100 let syn_loader = std::sync::Arc::new(syntax::Loader::new(syn_loader_conf));
89101
90102 let mut editor = Editor::new(