diff --git a/Cargo.lock b/Cargo.lock index ecbe2ef20991..83dbc93f892d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4653,6 +4653,7 @@ dependencies = [ "tracing-test", "tree-sitter-go", "tree-sitter-java", + "tree-sitter-kotlin", "tree-sitter-python", "tree-sitter-ruby", "tree-sitter-rust", @@ -5506,6 +5507,16 @@ dependencies = [ "tree-sitter", ] +[[package]] +name = "tree-sitter-kotlin" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5f367466210220a194a2d8831fc12d15aa13305e7bcdf2dba47714aa328e86" +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 d6e5b9f35c29..e77ab0a37c38 100644 --- a/crates/tabby-common/assets/languages.toml +++ b/crates/tabby-common/assets/languages.toml @@ -41,6 +41,30 @@ top_level_keywords = [ "return", ] +[[config]] +languages = ["kotlin"] +line_comment = "//" +top_level_keywords = [ + "abstract", + "public", + "private", + "companion", + "class", + "data", + "const", + "actual", + "expect", + "sealed", + "suspend", + "fun", + "import", + "interface", + "package", + "var", + "val", + "enum", +] + [[config]] languages = ["javascript", "typescript", "javascriptreact", "typescriptreact"] line_comment = "//" diff --git a/crates/tabby-scheduler/Cargo.toml b/crates/tabby-scheduler/Cargo.toml index e0f49e85ed90..0d2c99e4425f 100644 --- a/crates/tabby-scheduler/Cargo.toml +++ b/crates/tabby-scheduler/Cargo.toml @@ -17,6 +17,7 @@ serde-jsonlines = { workspace = true } file-rotate = "0.7.5" tree-sitter-python = "0.20.2" tree-sitter-java = "0.20.2" +tree-sitter-kotlin = "0.3.1" tree-sitter-rust = "0.20.3" tree-sitter-typescript = "0.20.3" tree-sitter-go = "0.20.0" diff --git a/crates/tabby-scheduler/queries/kotlin.scm b/crates/tabby-scheduler/queries/kotlin.scm new file mode 100644 index 000000000000..cb8c933bb05a --- /dev/null +++ b/crates/tabby-scheduler/queries/kotlin.scm @@ -0,0 +1,12 @@ +( + (function_declaration (simple_identifier) @name) @definition.function +) + +( + (class_declaration (type_identifier) @name) @definition.class +) + +( + (object_literal (delegation_specifier) @name) @definition.object +) + diff --git a/crates/tabby-scheduler/src/dataset.rs b/crates/tabby-scheduler/src/dataset.rs index 4cd4ca007a33..e2c61a6ab9c3 100644 --- a/crates/tabby-scheduler/src/dataset.rs +++ b/crates/tabby-scheduler/src/dataset.rs @@ -157,6 +157,7 @@ lazy_static! { ("haskell", vec!["hs"]), ("html", vec!["html"]), ("java", vec!["java"]), + ("kotlin", vec!["kt", "kts"]), ("julia", vec!["jl"]), ("lua", vec!["lua"]), ("makefile", vec!["Makefile"]), diff --git a/crates/tabby-scheduler/src/dataset/tags.rs b/crates/tabby-scheduler/src/dataset/tags.rs index 7fbf87da68d5..305d8cb00c38 100644 --- a/crates/tabby-scheduler/src/dataset/tags.rs +++ b/crates/tabby-scheduler/src/dataset/tags.rs @@ -73,6 +73,17 @@ lazy_static! { .unwrap(), ), ), + ( + "kotlin", + TagsConfigurationSync( + TagsConfiguration::new( + tree_sitter_kotlin::language(), + include_str!("../../queries/kotlin.scm"), + "", + ) + .unwrap(), + ), + ), ( "javascript-typescript", TagsConfigurationSync( diff --git a/website/docs/programming-languages.md b/website/docs/programming-languages.md index 23a11a8e9e9d..4c9586b94f09 100644 --- a/website/docs/programming-languages.md +++ b/website/docs/programming-languages.md @@ -28,6 +28,7 @@ For an actual example of an issue or pull request adding the above support, plea * [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 +* [Kotlin](https://www.kotlinlang.org/): Since v0.6.0 ## Languages Missing Certain Support @@ -42,3 +43,4 @@ For an actual example of an issue or pull request adding the above support, plea | PHP | 🚫 | 🚫 | | Perl | 🚫 | 🚫 | | Scala | 🚫 | 🚫 | +| Kotlin | 🚫 | 🚫 |