aboutsummaryrefslogtreecommitdiff
path: root/helix-loader/src/config.rs
diff options
context:
space:
mode:
authorPascal Kuthe2023-02-07 14:59:04 +0000
committerBlaž Hrastnik2023-03-29 03:57:30 +0000
commit5b3dd6a678ba138ea21d7d5dd8d3c8a53c7a6d3b (patch)
tree038502a6e1d4f7b4a90ac407f3debf00ede211c1 /helix-loader/src/config.rs
parent2d10a429ebf7abe5af184b6227346377dc0523e8 (diff)
implement proper lsp-workspace support
fix typo Co-authored-by: LeoniePhiline <22329650+LeoniePhiline@users.noreply.github.com>
Diffstat (limited to 'helix-loader/src/config.rs')
-rw-r--r--helix-loader/src/config.rs61
1 files changed, 32 insertions, 29 deletions
diff --git a/helix-loader/src/config.rs b/helix-loader/src/config.rs
index 8924c8fb..d092d20f 100644
--- a/helix-loader/src/config.rs
+++ b/helix-loader/src/config.rs
@@ -9,35 +9,38 @@ pub fn default_lang_config() -> toml::Value {
/// User configured languages.toml file, merged with the default config.
pub fn user_lang_config() -> Result<toml::Value, toml::de::Error> {
- let config = [crate::config_dir(), crate::find_workspace().join(".helix")]
- .into_iter()
- .map(|path| path.join("languages.toml"))
- .filter_map(|file| {
- std::fs::read_to_string(file)
- .map(|config| toml::from_str(&config))
- .ok()
- })
- .collect::<Result<Vec<_>, _>>()?
- .into_iter()
- .fold(default_lang_config(), |a, b| {
- // 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(a, b, 3)
- });
+ let config = [
+ crate::config_dir(),
+ crate::find_workspace().0.join(".helix"),
+ ]
+ .into_iter()
+ .map(|path| path.join("languages.toml"))
+ .filter_map(|file| {
+ std::fs::read_to_string(file)
+ .map(|config| toml::from_str(&config))
+ .ok()
+ })
+ .collect::<Result<Vec<_>, _>>()?
+ .into_iter()
+ .fold(default_lang_config(), |a, b| {
+ // 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(a, b, 3)
+ });
Ok(config)
}