aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-10-10 03:32:06 +0000
committerBlaž Hrastnik2021-10-10 03:32:06 +0000
commit633b981db22bb30c601b838eaaeb814a64156125 (patch)
tree26ea79888179adc76a82f16c5cd0efc14ccb3c35 /helix-view/src
parentc7f3a971c0e42d1ecb8b91f075b2300040b656fa (diff)
Make idle-timeout configurable
Diffstat (limited to 'helix-view/src')
-rw-r--r--helix-view/src/editor.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs
index 5362acc8..5af6dbf3 100644
--- a/helix-view/src/editor.rs
+++ b/helix-view/src/editor.rs
@@ -26,6 +26,14 @@ use helix_core::Position;
use serde::Deserialize;
+fn deserialize_duration_millis<'de, D>(deserializer: D) -> Result<Duration, D::Error>
+where
+ D: serde::Deserializer<'de>,
+{
+ let millis = u64::deserialize(deserializer)?;
+ Ok(Duration::from_millis(millis))
+}
+
#[derive(Debug, Clone, PartialEq, Deserialize)]
#[serde(rename_all = "kebab-case", default)]
pub struct Config {
@@ -45,6 +53,9 @@ pub struct Config {
pub smart_case: bool,
/// Automatic insertion of pairs to parentheses, brackets, etc. Defaults to true.
pub auto_pairs: bool,
+ /// Time in milliseconds since last keypress before idle timers trigger. Used for autocompletion, set to 0 for instant. Defaults to 400ms.
+ #[serde(skip_serializing, deserialize_with = "deserialize_duration_millis")]
+ pub idle_timeout: Duration,
}
#[derive(Debug, Clone, PartialEq, Eq, Deserialize)]
@@ -72,6 +83,7 @@ impl Default for Config {
middle_click_paste: true,
smart_case: true,
auto_pairs: true,
+ idle_timeout: Duration::from_millis(400),
}
}
}