From 24af7a1bb0b7c67a350c35a5e1e9ac4bef734d35 Mon Sep 17 00:00:00 2001 From: "Guilherme G. Schardong" Date: Thu, 27 Jun 2024 09:31:35 -0700 Subject: [PATCH] feat: support for Lua (#2530) * feat: add lua language configuration * feat: add lua repository context support * updating programming-languages.md * Update website/docs/programming-languages.md * [autofix.ci] apply automated fixes --------- Co-authored-by: Meng Zhang Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- Cargo.lock | 11 +++++++++ crates/tabby-common/assets/languages.toml | 24 ++++++++++++++++++++ crates/tabby-scheduler/Cargo.toml | 1 + crates/tabby-scheduler/src/code/languages.rs | 11 +++++++++ website/docs/programming-languages.md | 2 +- 5 files changed, 48 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index b8e4730b8caa..43963f31d38c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5192,6 +5192,7 @@ dependencies = [ "tree-sitter-go", "tree-sitter-java", "tree-sitter-kotlin", + "tree-sitter-lua", "tree-sitter-python", "tree-sitter-ruby", "tree-sitter-rust", @@ -5978,6 +5979,16 @@ dependencies = [ "tree-sitter", ] +[[package]] +name = "tree-sitter-lua" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b9fe6fc87bd480e1943fc1fcb02453fb2da050e4e8ce0daa67d801544046856" +dependencies = [ + "cc", + "tree-sitter", +] + [[package]] name = "tree-sitter-python" version = "0.21.0" diff --git a/crates/tabby-common/assets/languages.toml b/crates/tabby-common/assets/languages.toml index 65437a3f566a..5de2658bfb0f 100644 --- a/crates/tabby-common/assets/languages.toml +++ b/crates/tabby-common/assets/languages.toml @@ -274,6 +274,30 @@ exts = ["jl"] [[config]] languages = ["lua"] exts = ["lua"] +line_comment = "--" +top_level_keywords = [ + "and", + "break", + "do", + "else", + "elseif", + "end", + "false", + "for", + "function", + "if", + "in", + "local", + "nil", + "not", + "or", + "repeat", + "return", + "then", + "true", + "until", + "while" +] [[config]] languages = ["makefile"] diff --git a/crates/tabby-scheduler/Cargo.toml b/crates/tabby-scheduler/Cargo.toml index 7e60e859c64b..121c8df07495 100644 --- a/crates/tabby-scheduler/Cargo.toml +++ b/crates/tabby-scheduler/Cargo.toml @@ -23,6 +23,7 @@ tree-sitter-c = { git = "https://github.com/tree-sitter/tree-sitter-c/", rev = " tree-sitter-cpp = { git = "https://github.com/tree-sitter/tree-sitter-cpp", rev = "d29fbff" } tree-sitter-c-sharp = "0.21.2" tree-sitter-solidity = { git = "https://github.com/JoranHonig/tree-sitter-solidity", rev = "0e86ae647bda22c9bee00ec59752df7b3d3b000b" } +tree-sitter-lua = "0.1.0" ignore.workspace = true tokio = { workspace = true, features = ["process"] } text-splitter = { version = "0.13.3", features = ["code"] } diff --git a/crates/tabby-scheduler/src/code/languages.rs b/crates/tabby-scheduler/src/code/languages.rs index 4e694c2dcc67..d3e98ffbd04f 100644 --- a/crates/tabby-scheduler/src/code/languages.rs +++ b/crates/tabby-scheduler/src/code/languages.rs @@ -136,6 +136,17 @@ lazy_static! { .unwrap(), ), ), + ( + "lua", + TagsConfigurationSync( + TagsConfiguration::new( + tree_sitter_lua::language(), + tree_sitter_lua::TAGS_QUERY, + "", + ) + .unwrap(), + ), + ), ]) }; } diff --git a/website/docs/programming-languages.md b/website/docs/programming-languages.md index 72cc5fb316b4..09159e63fe18 100644 --- a/website/docs/programming-languages.md +++ b/website/docs/programming-languages.md @@ -35,6 +35,7 @@ For an actual example of an issue or pull request adding the above support, plea * [Solidity](https://soliditylang.org/): Since v0.10.0 * [R](https://www.r-project.org/): Since v0.12.0 * [Dart](https://dart.dev/): Since v0.12.0 +* [Lua](https://www.lua.org): Since 0.14.0 ## Languages Missing Certain Support @@ -43,6 +44,5 @@ For an actual example of an issue or pull request adding the above support, plea | CSS | 🚫 | 🚫 | | Haskell | 🚫 | 🚫 | | Julia | 🚫 | 🚫 | -| Lua | 🚫 | 🚫 | | Perl | 🚫 | 🚫 | | Scala | 🚫 | 🚫 |