@@ -1,4 +1,7 @@
2+ config::{default_syntax_loader, user_syntax_loader},
1−use helix_core::{merge_toml_values, pos_at_coords, syntax, Selection};
3+ pos_at_coords, syntax, Selection,
2use helix_dap::{self as dap, Payload, Request};
5use helix_dap::{self as dap, Payload, Request};
3use helix_lsp::{lsp, util::lsp_pos_to_pos, LspProgressMap};
6use helix_lsp::{lsp, util::lsp_pos_to_pos, LspProgressMap};
4use helix_view::{editor::Breakpoint, theme, Editor};
7use helix_view::{editor::Breakpoint, theme, Editor};
@@ -69,21 +72,6 @@ impl Application {
69 std::sync::Arc::new(theme::Loader::new(&conf_dir, &helix_core::runtime_dir()));
72 std::sync::Arc::new(theme::Loader::new(&conf_dir, &helix_core::runtime_dir()));
71 // load default and user config, and merge both
74 // 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"))
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),
87 let true_color = config.editor.true_color || crate::true_color();
75 let true_color = config.editor.true_color || crate::true_color();
88 let theme = config
76 let theme = config
@@ -106,16 +94,14 @@ impl Application {
109− let syn_loader_conf: helix_core::syntax::Configuration = lang_conf
110− .and_then(|conf| conf.try_into())
111− .unwrap_or_else(|err| {
97+ let syn_loader_conf = user_syntax_loader().unwrap_or_else(|err| {
112− eprintln!("Bad language config: {}", err);
98+ eprintln!("Bad language config: {}", err);
113− eprintln!("Press <ENTER> to continue with default language config");
99+ eprintln!("Press <ENTER> to continue with default language config");
114− use std::io::Read;
100+ use std::io::Read;
115− // This waits for an enter press.
101+ // This waits for an enter press.
116− let _ = std::io::stdin().read(&mut []);
102+ let _ = std::io::stdin().read(&mut []);
117− def_syn_loader_conf
103+ default_syntax_loader()
119 let syn_loader = std::sync::Arc::new(syntax::Loader::new(syn_loader_conf));
105 let syn_loader = std::sync::Arc::new(syntax::Loader::new(syn_loader_conf));
121 let mut editor = Editor::new(
107 let mut editor = Editor::new(