From da6109c5af2ca58be91cc0f49c706c1fa7d25376 Mon Sep 17 00:00:00 2001 From: Chromium Date: Fri, 20 Oct 2023 20:48:37 +0200 Subject: [PATCH] feat: Add Ruby Language Support (#597) * feat: add Ruby Support * fix: address the comments * Update dataset.rs --------- Co-authored-by: Meng Zhang --- Cargo.lock | 11 +++++++++++ crates/tabby-common/assets/languages.toml | 18 +++++++++++++++++- crates/tabby-scheduler/Cargo.toml | 1 + crates/tabby-scheduler/src/dataset.rs | 11 +++++++++++ website/docs/programming-languages.md | 2 +- 5 files changed, 41 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 44855c511fd0..baac196feb6a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3221,6 +3221,7 @@ dependencies = [ "tracing-test", "tree-sitter-go", "tree-sitter-python", + "tree-sitter-ruby", "tree-sitter-rust", "tree-sitter-tags", "tree-sitter-typescript", @@ -3960,6 +3961,16 @@ dependencies = [ "tree-sitter", ] +[[package]] +name = "tree-sitter-ruby" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ac30cbb1560363ae76e1ccde543d6d99087421e228cc47afcec004b86bb711a" +dependencies = [ + "cc", + "tree-sitter", +] + [[package]] name = "tree-sitter-rust" version = "0.20.3" diff --git a/crates/tabby-common/assets/languages.toml b/crates/tabby-common/assets/languages.toml index b13fcd609d26..542fe844bdff 100644 --- a/crates/tabby-common/assets/languages.toml +++ b/crates/tabby-common/assets/languages.toml @@ -50,4 +50,20 @@ top_level_keywords = [ "import", "var", "const", -] \ No newline at end of file +] + +[[config]] +languages = ["ruby"] +line_comment = "#" +top_level_keywords = [ + "begin", + "class", + "def", + "end", + "ensure", + "include", + "module", + "require", + "rescue", + "self", +] diff --git a/crates/tabby-scheduler/Cargo.toml b/crates/tabby-scheduler/Cargo.toml index 531f6fdfbc4c..2f50b3cf8bf0 100644 --- a/crates/tabby-scheduler/Cargo.toml +++ b/crates/tabby-scheduler/Cargo.toml @@ -22,6 +22,7 @@ tree-sitter-python = "0.20.2" tree-sitter-rust = "0.20.3" tree-sitter-typescript = "0.20.3" tree-sitter-go = "0.20.0" +tree-sitter-ruby= "0.20.0" [dev-dependencies] temp_testdir = "0.2" diff --git a/crates/tabby-scheduler/src/dataset.rs b/crates/tabby-scheduler/src/dataset.rs index c6eb965dd491..0ddb688a1b88 100644 --- a/crates/tabby-scheduler/src/dataset.rs +++ b/crates/tabby-scheduler/src/dataset.rs @@ -270,6 +270,17 @@ lazy_static! { .unwrap(), ), ), + ( + "ruby", + TagsConfigurationSync( + TagsConfiguration::new( + tree_sitter_ruby::language(), + tree_sitter_rust::TAGGING_QUERY, + "", + ) + .unwrap(), + ), + ), ]) }; } diff --git a/website/docs/programming-languages.md b/website/docs/programming-languages.md index 6bdec398a25a..9c0ff1ffcb75 100644 --- a/website/docs/programming-languages.md +++ b/website/docs/programming-languages.md @@ -26,6 +26,7 @@ For an actual example of an issue or pull request adding the above support, plea * [JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript) * [TypeScript](https://www.typescriptlang.org/) * [Golang](https://go.dev/): Since v0.4.0 +* [Ruby](https://www.ruby-lang.org/): Since v0.4.0 ## Languages Missing Certain Support @@ -40,5 +41,4 @@ For an actual example of an issue or pull request adding the above support, plea | Lua | 🚫 | 🚫 | | PHP | 🚫 | 🚫 | | Perl | 🚫 | 🚫 | -| Ruby | 🚫 | 🚫 | | Scala | 🚫 | 🚫 |