@@ -1,4 +1,7 @@
1−use helix_core::{merge_toml_values, pos_at_coords, syntax, Selection};
1+use helix_core::{
2+ config::{default_syntax_loader, user_syntax_loader},
3+ pos_at_coords, syntax, Selection,
4+};
25use helix_dap::{self as dap, Payload, Request};
36use helix_lsp::{lsp, util::lsp_pos_to_pos, LspProgressMap};
47use helix_view::{editor::Breakpoint, theme, Editor};
@@ -69,21 +72,6 @@ impl Application {
6972 std::sync::Arc::new(theme::Loader::new(&conf_dir, &helix_core::runtime_dir()));
7073
7174 // load default and user config, and merge both
72− let builtin_err_msg =
73− "Could not parse built-in languages.toml, something must be very wrong";
74− let def_lang_conf: toml::Value =
75− toml::from_slice(include_bytes!("../../languages.toml")).expect(builtin_err_msg);
76− let def_syn_loader_conf: helix_core::syntax::Configuration =
77− def_lang_conf.clone().try_into().expect(builtin_err_msg);
78− let user_lang_conf = std::fs::read(conf_dir.join("languages.toml"))
79− .ok()
80− .map(|raw| toml::from_slice(&raw));
81− let lang_conf = match user_lang_conf {
82− Some(Ok(value)) => Ok(merge_toml_values(def_lang_conf, value)),
83− Some(err @ Err(_)) => err,
84− None => Ok(def_lang_conf),
85− };
86−
8775 let true_color = config.editor.true_color || crate::true_color();
8876 let theme = config
8977 .theme
@@ -106,16 +94,14 @@ impl Application {
10694 }
10795 });
10896
109− let syn_loader_conf: helix_core::syntax::Configuration = lang_conf
110− .and_then(|conf| conf.try_into())
111− .unwrap_or_else(|err| {
112− eprintln!("Bad language config: {}", err);
113− eprintln!("Press <ENTER> to continue with default language config");
114− use std::io::Read;
115− // This waits for an enter press.
116− let _ = std::io::stdin().read(&mut []);
117− def_syn_loader_conf
118− });
97+ let syn_loader_conf = user_syntax_loader().unwrap_or_else(|err| {
98+ eprintln!("Bad language config: {}", err);
99+ eprintln!("Press <ENTER> to continue with default language config");
100+ use std::io::Read;
101+ // This waits for an enter press.
102+ let _ = std::io::stdin().read(&mut []);
103+ default_syntax_loader()
104+ });
119105 let syn_loader = std::sync::Arc::new(syntax::Loader::new(syn_loader_conf));
120106
121107 let mut editor = Editor::new(