aboutsummaryrefslogtreecommitdiff
path: root/helix-core/src
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-10-17 04:51:56 +0000
committerBlaž Hrastnik2021-10-17 04:51:56 +0000
commit0a6b60085a56876068bf652c9491c435e9cca229 (patch)
tree8681db55d1a7707421f98d81a108d6438459536a /helix-core/src
parentbc0084d071ac53fa460370667cdd8740e7499c76 (diff)
parente216e9621e73cda1968632cd20595231af5e07be (diff)
Merge branch 'master' into debug
Diffstat (limited to 'helix-core/src')
-rw-r--r--helix-core/src/selection.rs8
-rw-r--r--helix-core/src/syntax.rs13
2 files changed, 16 insertions, 5 deletions
diff --git a/helix-core/src/selection.rs b/helix-core/src/selection.rs
index 755ee679..18af4d08 100644
--- a/helix-core/src/selection.rs
+++ b/helix-core/src/selection.rs
@@ -29,10 +29,10 @@ use std::borrow::Cow;
/// "(anchor, head)", followed by example text with "[" and "]"
/// inserted to represent the anchor and head positions:
///
-/// - (0, 3): [Som]e text.
-/// - (3, 0): ]Som[e text.
-/// - (2, 7): So[me te]xt.
-/// - (1, 1): S[]ome text.
+/// - (0, 3): `[Som]e text`.
+/// - (3, 0): `]Som[e text`.
+/// - (2, 7): `So[me te]xt`.
+/// - (1, 1): `S[]ome text`.
///
/// Ranges are considered to be inclusive on the left and
/// exclusive on the right, regardless of anchor-head ordering.
diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs
index 996823ce..00c09ea2 100644
--- a/helix-core/src/syntax.rs
+++ b/helix-core/src/syntax.rs
@@ -31,6 +31,15 @@ where
.transpose()
}
+fn deserialize_lsp_config<'de, D>(deserializer: D) -> Result<Option<serde_json::Value>, D::Error>
+where
+ D: serde::Deserializer<'de>,
+{
+ Option::<toml::Value>::deserialize(deserializer)?
+ .map(|toml| toml.try_into().map_err(serde::de::Error::custom))
+ .transpose()
+}
+
#[derive(Debug, Serialize, Deserialize)]
pub struct Configuration {
pub language: Vec<LanguageConfiguration>,
@@ -46,7 +55,9 @@ pub struct LanguageConfiguration {
pub file_types: Vec<String>, // filename ends_with? <Gemfile, rb, etc>
pub roots: Vec<String>, // these indicate project roots <.git, Cargo.toml>
pub comment_token: Option<String>,
- pub config: Option<String>,
+
+ #[serde(default, skip_serializing, deserialize_with = "deserialize_lsp_config")]
+ pub config: Option<serde_json::Value>,
#[serde(default)]
pub auto_format: bool,