From 688e7d75b5ebb3d79cf9f98c77001320c6ae8adb Mon Sep 17 00:00:00 2001 From: Oleksandr Date: Thu, 26 Oct 2023 22:27:57 +0300 Subject: [PATCH] feat: supports PHP (#634) * feat: add php language configuration * feat: add php repository context support * docs: update documentation to indicate php support * Update programming-languages.md * added rev to tree-sitter-php --------- Co-authored-by: Aleksandr Tarabaka Co-authored-by: Meng Zhang --- Cargo.lock | 10 ++++++++ crates/tabby-common/assets/languages.toml | 28 +++++++++++++++++++++++ crates/tabby-scheduler/Cargo.toml | 1 + crates/tabby-scheduler/src/dataset.rs | 11 +++++++++ website/docs/programming-languages.md | 2 +- 5 files changed, 51 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 9ff1de5c059c..4e73bf6f9956 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3261,6 +3261,7 @@ dependencies = [ "tracing", "tracing-test", "tree-sitter-go", + "tree-sitter-php", "tree-sitter-python", "tree-sitter-ruby", "tree-sitter-rust", @@ -3991,6 +3992,15 @@ dependencies = [ "tree-sitter", ] +[[package]] +name = "tree-sitter-php" +version = "0.19.1" +source = "git+https://github.com/tree-sitter/tree-sitter-php.git#0e02e7fab7913a0e77343edb347c8f17cac1f0ba" +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..7943b4ee1a20 100644 --- a/crates/tabby-common/assets/languages.toml +++ b/crates/tabby-common/assets/languages.toml @@ -67,3 +67,31 @@ top_level_keywords = [ "rescue", "self", ] + +[[config]] +languages = ["php"] +line_comment = "//" +top_level_keywords = [ + "abstract", + "class", + "const", + "declare", + "extends", + "final", + "finally", + "function", + "global", + "implements", + "include_once", + "include", + "interface", + "namespace", + "private", + "protected", + "public", + "require_once", + "require", + "static", + "trait", + "use", +] diff --git a/crates/tabby-scheduler/Cargo.toml b/crates/tabby-scheduler/Cargo.toml index 92b058856a31..62d1c51310f7 100644 --- a/crates/tabby-scheduler/Cargo.toml +++ b/crates/tabby-scheduler/Cargo.toml @@ -22,6 +22,7 @@ tree-sitter-rust = "0.20.3" tree-sitter-typescript = "0.20.3" tree-sitter-go = "0.20.0" tree-sitter-ruby= "0.20.0" +tree-sitter-php = { git = "https://github.com/tree-sitter/tree-sitter-php.git", rev = "0e02e7f" } ignore = "0.4.20" [dev-dependencies] diff --git a/crates/tabby-scheduler/src/dataset.rs b/crates/tabby-scheduler/src/dataset.rs index a4852d35f758..3e17d74fa5bf 100644 --- a/crates/tabby-scheduler/src/dataset.rs +++ b/crates/tabby-scheduler/src/dataset.rs @@ -271,6 +271,17 @@ lazy_static! { .unwrap(), ), ), + ( + "php", + TagsConfigurationSync( + TagsConfiguration::new( + tree_sitter_php::language(), + tree_sitter_php::TAGS_QUERY, + "", + ) + .unwrap(), + ), + ), ]) }; } diff --git a/website/docs/programming-languages.md b/website/docs/programming-languages.md index 9c0ff1ffcb75..ec01e058fdfe 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 +* [PHP](https://www.php.net/): Since v0.5.0 ## Languages Missing Certain Support @@ -39,6 +40,5 @@ For an actual example of an issue or pull request adding the above support, plea | Java | 🚫 | 🚫 | | Julia | 🚫 | 🚫 | | Lua | 🚫 | 🚫 | -| PHP | 🚫 | 🚫 | | Perl | 🚫 | 🚫 | | Scala | 🚫 | 🚫 |