diff options
author | Daniel Ebert | 2023-09-19 13:31:38 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2023-12-15 06:59:54 +0000 |
commit | 938a710904ae6d328d4008626d98acb9e907813a (patch) | |
tree | df6a641d82d0c82b61ecc7ffe68011d0dca24453 /helix-core/src/syntax.rs | |
parent | 559bfc1f5ef1bd43fd94325c0363058e32c76df4 (diff) |
Make the indent heuristic configurable
Diffstat (limited to 'helix-core/src/syntax.rs')
-rw-r--r-- | helix-core/src/syntax.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs index 8c7fc4e1..dd922316 100644 --- a/helix-core/src/syntax.rs +++ b/helix-core/src/syntax.rs @@ -442,6 +442,22 @@ pub struct IndentationConfiguration { pub unit: String, } +/// How the indentation for a newly inserted line should be determined. +/// If the selected heuristic is not available (e.g. because the current +/// language has no tree-sitter indent queries), a simpler one will be used. +#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "kebab-case")] +pub enum IndentationHeuristic { + /// Just copy the indentation of the line that the cursor is currently on. + Simple, + /// Use tree-sitter indent queries to compute the expected absolute indentation level of the new line. + TreeSitter, + /// Use tree-sitter indent queries to compute the expected difference in indentation between the new line + /// and the line before. Add this to the actual indentation level of the line before. + #[default] + Hybrid, +} + /// Configuration for auto pairs #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "kebab-case", deny_unknown_fields, untagged)] |