From 3fb8445747691e0d60e10c776cdaa8486e99c65e Mon Sep 17 00:00:00 2001 From: leiwen83 Date: Wed, 8 Nov 2023 15:59:00 +0800 Subject: [PATCH] feat: supports java (#715) * feat: add java language configuration * feat: add java repository context support * Update programming-languages.md * added rev to tree-sitter-java Signed-off-by: Lei Wen Co-authored-by: Lei Wen --- Cargo.lock | 11 +++++++++++ crates/tabby-common/assets/languages.toml | 22 ++++++++++++++++++++++ crates/tabby-scheduler/Cargo.toml | 1 + crates/tabby-scheduler/src/dataset.rs | 11 +++++++++++ website/docs/programming-languages.md | 2 +- 5 files changed, 46 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 116a794f0df9..1f8bb67742c0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4158,6 +4158,7 @@ dependencies = [ "tracing", "tracing-test", "tree-sitter-go", + "tree-sitter-java", "tree-sitter-python", "tree-sitter-ruby", "tree-sitter-rust", @@ -4902,6 +4903,16 @@ dependencies = [ "tree-sitter", ] +[[package]] +name = "tree-sitter-java" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2adc5696bf5abf761081d7457d2bb82d0e3b28964f4214f63fd7e720ef462653" +dependencies = [ + "cc", + "tree-sitter", +] + [[package]] name = "tree-sitter-python" version = "0.20.2" diff --git a/crates/tabby-common/assets/languages.toml b/crates/tabby-common/assets/languages.toml index 542fe844bdff..d6e5b9f35c29 100644 --- a/crates/tabby-common/assets/languages.toml +++ b/crates/tabby-common/assets/languages.toml @@ -19,6 +19,28 @@ top_level_keywords = [ "use", ] +[[config]] +languages = ["java"] +line_comment = "//" +top_level_keywords = [ + "abstract", + "public", + "private", + "class", + "const", + "exports", + "extends", + "implements", + "static", + "import", + "interface", + "module", + "package", + "var", + "enum", + "return", +] + [[config]] languages = ["javascript", "typescript", "javascriptreact", "typescriptreact"] line_comment = "//" diff --git a/crates/tabby-scheduler/Cargo.toml b/crates/tabby-scheduler/Cargo.toml index 59177feaa0bd..e0c701c51515 100644 --- a/crates/tabby-scheduler/Cargo.toml +++ b/crates/tabby-scheduler/Cargo.toml @@ -16,6 +16,7 @@ lazy_static = { workspace = true } serde-jsonlines = { workspace = true } file-rotate = "0.7.5" tree-sitter-python = "0.20.2" +tree-sitter-java = "0.20.2" tree-sitter-rust = "0.20.3" tree-sitter-typescript = "0.20.3" tree-sitter-go = "0.20.0" diff --git a/crates/tabby-scheduler/src/dataset.rs b/crates/tabby-scheduler/src/dataset.rs index a4852d35f758..9366e86d1c77 100644 --- a/crates/tabby-scheduler/src/dataset.rs +++ b/crates/tabby-scheduler/src/dataset.rs @@ -238,6 +238,17 @@ lazy_static! { .unwrap(), ), ), + ( + "java", + TagsConfigurationSync( + TagsConfiguration::new( + tree_sitter_java::language(), + tree_sitter_java::TAGGING_QUERY, + "", + ) + .unwrap(), + ), + ), ( "javascript-typescript", TagsConfigurationSync( diff --git a/website/docs/programming-languages.md b/website/docs/programming-languages.md index 9c0ff1ffcb75..23a11a8e9e9d 100644 --- a/website/docs/programming-languages.md +++ b/website/docs/programming-languages.md @@ -27,6 +27,7 @@ For an actual example of an issue or pull request adding the above support, plea * [TypeScript](https://www.typescriptlang.org/) * [Golang](https://go.dev/): Since v0.4.0 * [Ruby](https://www.ruby-lang.org/): Since v0.4.0 +* [Java](https://www.java.com/): Since v0.6.0 ## Languages Missing Certain Support @@ -36,7 +37,6 @@ For an actual example of an issue or pull request adding the above support, plea | C# | 🚫 | 🚫 | | CSS | 🚫 | 🚫 | | Haskell | 🚫 | 🚫 | -| Java | 🚫 | 🚫 | | Julia | 🚫 | 🚫 | | Lua | 🚫 | 🚫 | | PHP | 🚫 | 🚫 |