highlighter: Adding tree-sitter-sequel for SQL support. (#917)
📦 Adding dependency: [tree-sitter-sequel](https://github.com/derekstride/tree-sitter-sql) ### Previews <img width="1398" alt="Screenshot 2025-06-04 at 9 27 08 PM" src="https://github.com/user-attachments/assets/4aee67be-6fb3-4c57-95be-20792639851a" /> <img width="1398" alt="Screenshot 2025-06-04 at 9 34 02 PM" src="https://github.com/user-attachments/assets/730e148f-2bc9-481d-8eea-8110f7884e69" />
This commit is contained in:
parent
a1bdd50735
commit
4477cca969
5 changed files with 29 additions and 1 deletions
11
Cargo.lock
generated
11
Cargo.lock
generated
|
|
@ -2898,6 +2898,7 @@ dependencies = [
|
|||
"tree-sitter-ruby",
|
||||
"tree-sitter-rust",
|
||||
"tree-sitter-scala",
|
||||
"tree-sitter-sequel",
|
||||
"tree-sitter-swift",
|
||||
"tree-sitter-toml-ng",
|
||||
"tree-sitter-typescript",
|
||||
|
|
@ -7716,6 +7717,16 @@ dependencies = [
|
|||
"tree-sitter-language",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tree-sitter-sequel"
|
||||
version = "0.3.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1f2550ddbfd7f52da6d7fd4bb145e20dc67f3a0cdfdae068034a2a16101e668b"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"tree-sitter-language",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tree-sitter-swift"
|
||||
version = "0.7.0"
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ pub struct Example {
|
|||
_subscribes: Vec<Subscription>,
|
||||
}
|
||||
|
||||
const LANGUAGES: [(Language, &'static str); 7] = [
|
||||
const LANGUAGES: [(Language, &'static str); 8] = [
|
||||
(Language::Rust, include_str!("./fixtures/test.rs")),
|
||||
(Language::JavaScript, include_str!("./fixtures/test.js")),
|
||||
(Language::Go, include_str!("./fixtures/test.go")),
|
||||
|
|
@ -26,6 +26,7 @@ const LANGUAGES: [(Language, &'static str); 7] = [
|
|||
(Language::Ruby, include_str!("./fixtures/test.rb")),
|
||||
(Language::Zig, include_str!("./fixtures/test.zig")),
|
||||
(Language::C, include_str!("./fixtures/test.c")),
|
||||
(Language::Sql, include_str!("./fixtures/test.sql")),
|
||||
];
|
||||
|
||||
impl Example {
|
||||
|
|
|
|||
5
crates/story/examples/fixtures/test.sql
Normal file
5
crates/story/examples/fixtures/test.sql
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
SELECT *
|
||||
FROM users
|
||||
WHERE email ilike '%test%'
|
||||
AND deleted_at IS NOT NULL
|
||||
LIMIT 1;
|
||||
|
|
@ -79,6 +79,7 @@ tree-sitter-ruby = "0.23.1"
|
|||
tree-sitter-rust = "0.24.0"
|
||||
tree-sitter-scala = "0.23.4"
|
||||
tree-sitter-swift = "0.7.0"
|
||||
tree-sitter-sequel = "0.3.8"
|
||||
tree-sitter-toml-ng = "0.7.0"
|
||||
tree-sitter-typescript = "0.23.2"
|
||||
tree-sitter-yaml = "0.7.1"
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ pub enum Language {
|
|||
Css,
|
||||
Swift,
|
||||
Scala,
|
||||
Sql,
|
||||
CSharp,
|
||||
GraphQL,
|
||||
Proto,
|
||||
|
|
@ -90,6 +91,7 @@ impl Language {
|
|||
Self::Css => "css",
|
||||
Self::Swift => "swift",
|
||||
Self::Scala => "scala",
|
||||
Self::Sql => "sql",
|
||||
Self::CSharp => "csharp",
|
||||
Self::GraphQL => "graphql",
|
||||
Self::Proto => "proto",
|
||||
|
|
@ -125,6 +127,7 @@ impl Language {
|
|||
"css" | "scss" => Some(Self::Css),
|
||||
"swift" => Some(Self::Swift),
|
||||
"scala" => Some(Self::Scala),
|
||||
"sql" => Some(Self::Sql),
|
||||
"csharp" | "cs" => Some(Self::CSharp),
|
||||
"graphql" => Some(Self::GraphQL),
|
||||
"proto" | "protobuf" => Some(Self::Proto),
|
||||
|
|
@ -270,6 +273,12 @@ impl Language {
|
|||
"",
|
||||
tree_sitter_scala::LOCALS_QUERY,
|
||||
),
|
||||
Self::Sql => (
|
||||
tree_sitter_sequel::LANGUAGE,
|
||||
tree_sitter_sequel::HIGHLIGHTS_QUERY,
|
||||
"",
|
||||
"",
|
||||
),
|
||||
Self::CSharp => (tree_sitter_c_sharp::LANGUAGE, "", "", ""),
|
||||
Self::GraphQL => (tree_sitter_graphql::LANGUAGE, "", "", ""),
|
||||
Self::Proto => (tree_sitter_proto::LANGUAGE, "", "", ""),
|
||||
|
|
@ -338,6 +347,7 @@ mod tests {
|
|||
assert_eq!(Language::Go.name(), "go");
|
||||
assert_eq!(Language::C.name(), "c");
|
||||
assert_eq!(Language::Cpp.name(), "cpp");
|
||||
assert_eq!(Language::Sql.name(), "sql");
|
||||
assert_eq!(Language::JavaScript.name(), "javascript");
|
||||
assert_eq!(Language::Zig.name(), "zig");
|
||||
assert_eq!(Language::CSharp.name(), "csharp");
|
||||
|
|
|
|||
Loading…
Reference in a new issue