diff options
Diffstat (limited to 'helix-core')
-rw-r--r-- | helix-core/src/indent.rs | 1 | ||||
-rw-r--r-- | helix-core/src/syntax.rs | 29 |
2 files changed, 29 insertions, 1 deletions
diff --git a/helix-core/src/indent.rs b/helix-core/src/indent.rs index 9a329d95..83b2be94 100644 --- a/helix-core/src/indent.rs +++ b/helix-core/src/indent.rs @@ -444,6 +444,7 @@ where debugger: None, auto_pairs: None, }], + grammar: vec![], }); // set runtime path so we can find the queries diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs index c39e0584..53d20da3 100644 --- a/helix-core/src/syntax.rs +++ b/helix-core/src/syntax.rs @@ -54,6 +54,7 @@ where #[serde(deny_unknown_fields)] pub struct Configuration { pub language: Vec<LanguageConfiguration>, + pub grammar: Vec<GrammarConfiguration>, } // largely based on tree-sitter/cli/src/loader.rs @@ -239,6 +240,29 @@ pub struct IndentQuery { pub outdent: HashSet<String>, } +#[derive(Debug, Serialize, Deserialize)] +pub struct GrammarConfiguration { + #[serde(rename = "name")] + pub grammar_id: String, // c-sharp, rust + pub source: GrammarSource, + pub path: Option<String>, +} + +#[derive(Debug, Serialize, Deserialize)] +#[serde(rename_all = "lowercase")] +#[serde(untagged)] +pub enum GrammarSource { + Local { + path: String, + }, + Git { + #[serde(rename = "git")] + remote: String, + #[serde(rename = "rev")] + revision: String, + }, +} + #[derive(Debug)] pub struct TextObjectQuery { pub query: Query, @@ -2055,7 +2079,10 @@ mod test { .map(String::from) .collect(); - let loader = Loader::new(Configuration { language: vec![] }); + let loader = Loader::new(Configuration { + language: vec![], + grammar: vec![], + }); let language = get_language(&crate::RUNTIME_DIR, "Rust").unwrap(); let config = HighlightConfiguration::new( |