aboutsummaryrefslogtreecommitdiff
path: root/helix-core/src/syntax.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-03-22 04:47:39 +0000
committerBlaž Hrastnik2021-03-22 04:53:36 +0000
commit5e6716c89c0909bc374e26bedbba703427f9aa26 (patch)
tree658163e26962c436d0406f8dcf0d5f900116efdc /helix-core/src/syntax.rs
parent698e4ddea46e9c94d537c8e4a6c69e7dc9ee1947 (diff)
Add tab_width and indent_unit config.
Diffstat (limited to 'helix-core/src/syntax.rs')
-rw-r--r--helix-core/src/syntax.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs
index c352f8f2..63e39f8f 100644
--- a/helix-core/src/syntax.rs
+++ b/helix-core/src/syntax.rs
@@ -29,6 +29,7 @@ pub struct LanguageConfiguration {
pub(crate) highlight_config: OnceCell<Option<Arc<HighlightConfiguration>>>,
// tags_config OnceCell<> https://github.com/tree-sitter/tree-sitter/pull/583
pub language_server_config: Option<LanguageServerConfiguration>,
+ pub indent_config: Option<IndentationConfiguration>,
}
pub struct LanguageServerConfiguration {
@@ -36,6 +37,11 @@ pub struct LanguageServerConfiguration {
pub args: Vec<String>,
}
+pub struct IndentationConfiguration {
+ pub tab_width: usize,
+ pub indent_unit: String,
+}
+
impl LanguageConfiguration {
pub fn highlight_config(&self, scopes: &[String]) -> Option<Arc<HighlightConfiguration>> {
self.highlight_config
@@ -104,6 +110,10 @@ impl Loader {
command: "rust-analyzer".to_string(),
args: vec![],
}),
+ indent_config: Some(IndentationConfiguration {
+ tab_width: 4,
+ indent_unit: String::from(" "),
+ }),
},
LanguageConfiguration {
scope: "source.toml".to_string(),
@@ -114,6 +124,10 @@ impl Loader {
path: "../helix-syntax/languages/tree-sitter-toml".into(),
roots: vec![],
language_server_config: None,
+ indent_config: Some(IndentationConfiguration {
+ tab_width: 2,
+ indent_unit: String::from(" "),
+ }),
},
];