From 766a15f24a2905b80b460194a39448293497ee6b Mon Sep 17 00:00:00 2001 From: Alex Ley Date: Sat, 9 Nov 2024 21:08:26 +0000 Subject: [PATCH] fix(patterns_directory.rs): add kotlin to the `PatternsDirectory` struct and add it to all match statements fixes #570 --- crates/gritmodule/src/patterns_directory.rs | 6 ++++++ resources/add_language.py | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/gritmodule/src/patterns_directory.rs b/crates/gritmodule/src/patterns_directory.rs index 1d2a88111..64d32cea1 100644 --- a/crates/gritmodule/src/patterns_directory.rs +++ b/crates/gritmodule/src/patterns_directory.rs @@ -13,6 +13,7 @@ pub struct PatternsDirectory { css: BTreeMap, json: BTreeMap, java: BTreeMap, + kotlin: BTreeMap, c_sharp: BTreeMap, python: BTreeMap, markdown_block: BTreeMap, @@ -69,6 +70,7 @@ impl PatternsDirectory { css: BTreeMap::new(), json: BTreeMap::new(), java: BTreeMap::new(), + kotlin: BTreeMap::new(), c_sharp: BTreeMap::new(), python: BTreeMap::new(), markdown_block: BTreeMap::new(), @@ -100,6 +102,7 @@ impl PatternsDirectory { PatternLanguage::Css => &mut self.css, PatternLanguage::Json => &mut self.json, PatternLanguage::Java => &mut self.java, + PatternLanguage::Kotlin => &mut self.kotlin, PatternLanguage::CSharp => &mut self.c_sharp, PatternLanguage::Python => &mut self.python, PatternLanguage::MarkdownBlock => &mut self.markdown_block, @@ -128,6 +131,7 @@ impl PatternsDirectory { PatternLanguage::Css => &self.css, PatternLanguage::Json => &self.json, PatternLanguage::Java => &self.java, + PatternLanguage::Kotlin => &self.kotlin, PatternLanguage::CSharp => &self.c_sharp, PatternLanguage::Python => &self.python, PatternLanguage::MarkdownBlock => &self.markdown_block, @@ -238,6 +242,8 @@ impl PatternsDirectory { self.json = other.json; other.java.extend(mem::take(&mut self.java)); self.java = other.java; + other.kotlin.extend(mem::take(&mut self.kotlin)); + self.kotlin = other.kotlin; other.c_sharp.extend(mem::take(&mut self.c_sharp)); self.c_sharp = other.c_sharp; other.python.extend(mem::take(&mut self.python)); diff --git a/resources/add_language.py b/resources/add_language.py index 2865afcee..33481d1ca 100644 --- a/resources/add_language.py +++ b/resources/add_language.py @@ -172,7 +172,8 @@ def main(args: Namespace): 2. add `tree-sitter-{language}` to crates/language/Cargo.toml [dependencies] and [features.builtin-parser] 3. add `pub mod {language};` to crates/language/src/lib.rs 4. add `use crate::{language}::{language_title_case}` to crates/language/src/target_language.rs and add it to all enums and match statements - 5. test cases for {language} in crates/core/src/test.rs + 5. add {language} to the `PatternsDirectory` struct in crates/gritmodule/src/patterns_directory.rs add it to all match statements + 6. add test cases for {language} in crates/core/src/test.rs """)