aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/config.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/src/config.rs')
-rw-r--r--helix-term/src/config.rs33
1 files changed, 12 insertions, 21 deletions
diff --git a/helix-term/src/config.rs b/helix-term/src/config.rs
index 2c95fae3..839235f1 100644
--- a/helix-term/src/config.rs
+++ b/helix-term/src/config.rs
@@ -1,35 +1,28 @@
use anyhow::{Error, Result};
-use std::{collections::HashMap, str::FromStr};
+use std::collections::HashMap;
use serde::{de::Error as SerdeError, Deserialize, Serialize};
use crate::keymap::{parse_keymaps, Keymaps};
-pub struct GlobalConfig {
- pub theme: Option<String>,
- pub lsp_progress: bool,
-}
-
-impl Default for GlobalConfig {
- fn default() -> Self {
- Self {
- lsp_progress: true,
- theme: None,
- }
- }
-}
-
#[derive(Default)]
pub struct Config {
- pub global: GlobalConfig,
+ pub theme: Option<String>,
+ pub lsp: LspConfig,
pub keymaps: Keymaps,
}
+#[derive(Default, Serialize, Deserialize)]
+pub struct LspConfig {
+ pub display_messages: bool,
+}
+
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
struct TomlConfig {
theme: Option<String>,
- lsp_progress: Option<bool>,
+ #[serde(default)]
+ lsp: LspConfig,
keys: Option<HashMap<String, HashMap<String, String>>>,
}
@@ -40,10 +33,8 @@ impl<'de> Deserialize<'de> for Config {
{
let config = TomlConfig::deserialize(deserializer)?;
Ok(Self {
- global: GlobalConfig {
- lsp_progress: config.lsp_progress.unwrap_or(true),
- theme: config.theme,
- },
+ theme: config.theme,
+ lsp: config.lsp,
keymaps: config
.keys
.map(|r| parse_keymaps(&r))