Skip to content

Commit

Permalink
fix(patterns_directory.rs): add kotlin to the PatternsDirectory str…
Browse files Browse the repository at this point in the history
…uct and add it to all match statements

fixes #570
  • Loading branch information
Alex-ley-scrub committed Nov 9, 2024
1 parent 07f0922 commit 766a15f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions crates/gritmodule/src/patterns_directory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub struct PatternsDirectory {
css: BTreeMap<String, String>,
json: BTreeMap<String, String>,
java: BTreeMap<String, String>,
kotlin: BTreeMap<String, String>,
c_sharp: BTreeMap<String, String>,
python: BTreeMap<String, String>,
markdown_block: BTreeMap<String, String>,
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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));
Expand Down
3 changes: 2 additions & 1 deletion resources/add_language.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
""")


Expand Down

0 comments on commit 766a15f

Please sign in to comment.