diff options
Diffstat (limited to 'helix-core/src/syntax.rs')
-rw-r--r-- | helix-core/src/syntax.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs index 52239d10..28aa31f9 100644 --- a/helix-core/src/syntax.rs +++ b/helix-core/src/syntax.rs @@ -81,12 +81,21 @@ where } #[derive(Debug, Serialize, Deserialize)] -#[serde(deny_unknown_fields)] +#[serde(rename_all = "kebab-case", deny_unknown_fields)] pub struct Configuration { + #[serde(rename = "use-grammars")] + pub grammar_selection: Option<GrammarSelection>, pub language: Vec<LanguageConfiguration>, pub grammar: Vec<GrammarConfiguration>, } +#[derive(Debug, Serialize, Deserialize)] +#[serde(rename_all = "lowercase", untagged)] +pub enum GrammarSelection { + Only(HashSet<String>), + Except(HashSet<String>), +} + // largely based on tree-sitter/cli/src/loader.rs #[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "kebab-case", deny_unknown_fields)] @@ -2110,6 +2119,7 @@ mod test { let loader = Loader::new(Configuration { language: vec![], grammar: vec![], + grammar_selection: None, }); let language = get_language(&crate::RUNTIME_DIR, "Rust").unwrap(); |