diff options
author | Pascal Kuthe | 2023-01-30 23:31:21 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2023-03-29 03:57:30 +0000 |
commit | 2d10a429ebf7abe5af184b6227346377dc0523e8 (patch) | |
tree | 114b19f0031fc001d7798a31372675a94623262f /helix-term/src/main.rs | |
parent | d59b80514e15d26f280a9b0dbd18afac08578638 (diff) |
add workspace config and manual LSP root management
fixup documentation
Co-authored-by: LeoniePhiline <22329650+LeoniePhiline@users.noreply.github.com>
fixup typo
Co-authored-by: LeoniePhiline <22329650+LeoniePhiline@users.noreply.github.com>
Diffstat (limited to 'helix-term/src/main.rs')
-rw-r--r-- | helix-term/src/main.rs | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/helix-term/src/main.rs b/helix-term/src/main.rs index aac5c537..e0c3f6e7 100644 --- a/helix-term/src/main.rs +++ b/helix-term/src/main.rs @@ -3,7 +3,7 @@ use crossterm::event::EventStream; use helix_loader::VERSION_AND_GIT_HASH; use helix_term::application::Application; use helix_term::args::Args; -use helix_term::config::Config; +use helix_term::config::{Config, ConfigLoadError}; use std::path::PathBuf; fn setup_logging(logpath: PathBuf, verbosity: u64) -> Result<()> { @@ -126,18 +126,19 @@ FLAGS: helix_loader::initialize_config_file(args.config_file.clone()); - let config = match std::fs::read_to_string(helix_loader::config_file()) { - Ok(config) => toml::from_str(&config) - .map(helix_term::keymap::merge_keys) - .unwrap_or_else(|err| { - eprintln!("Bad config: {}", err); - eprintln!("Press <ENTER> to continue with default config"); - use std::io::Read; - let _ = std::io::stdin().read(&mut []); - Config::default() - }), - Err(err) if err.kind() == std::io::ErrorKind::NotFound => Config::default(), - Err(err) => return Err(Error::new(err)), + let config = match Config::load_default() { + Ok(config) => config, + Err(ConfigLoadError::Error(err)) if err.kind() == std::io::ErrorKind::NotFound => { + Config::default() + } + Err(ConfigLoadError::Error(err)) => return Err(Error::new(err)), + Err(ConfigLoadError::BadConfig(err)) => { + eprintln!("Bad config: {}", err); + eprintln!("Press <ENTER> to continue with default config"); + use std::io::Read; + let _ = std::io::stdin().read(&mut []); + Config::default() + } }; let syn_loader_conf = helix_core::config::user_syntax_loader().unwrap_or_else(|err| { |