summaryrefslogtreecommitdiff
path: root/helix-loader/src/config.rs
diff options
context:
space:
mode:
authorPhilipp Mildenberger2022-07-26 00:40:38 +0000
committerGitHub2022-07-26 00:40:38 +0000
commit235237ddc45d398f5121f3a27ce6afb1d0ef570b (patch)
tree33bd2e238023017bd5fd06b6d46b1e348a28dbfe /helix-loader/src/config.rs
parentb7fa9ba6014f3253ec4ed56dd35d6ee29af36638 (diff)
Refactor 'helix-loader::merge_toml_values' to use a 'merge-depth' instead of 'merge_toplevel_arrays' (#3080)
- This ensures that other values than just the arrays are overridden, like nested objects, where it makes sense - merge_depth is set to 3 so that top-level language features are merged (like 'scope'), but everything deeper is overridden with the user-config
Diffstat (limited to 'helix-loader/src/config.rs')
-rw-r--r--helix-loader/src/config.rs18
1 files changed, 17 insertions, 1 deletions
diff --git a/helix-loader/src/config.rs b/helix-loader/src/config.rs
index a8c84361..259b1318 100644
--- a/helix-loader/src/config.rs
+++ b/helix-loader/src/config.rs
@@ -19,7 +19,23 @@ pub fn user_lang_config() -> Result<toml::Value, toml::de::Error> {
.into_iter()
.chain([default_lang_config()].into_iter())
.fold(toml::Value::Table(toml::value::Table::default()), |a, b| {
- crate::merge_toml_values(b, a, true)
+ // combines for example
+ // b:
+ // [[language]]
+ // name = "toml"
+ // language-server = { command = "taplo", args = ["lsp", "stdio"] }
+ //
+ // a:
+ // [[language]]
+ // language-server = { command = "/usr/bin/taplo" }
+ //
+ // into:
+ // [[language]]
+ // name = "toml"
+ // language-server = { command = "/usr/bin/taplo" }
+ //
+ // thus it overrides the third depth-level of b with values of a if they exist, but otherwise merges their values
+ crate::merge_toml_values(b, a, 3)
});
Ok(config)