Skip to content

Commit 3ab62e0

Browse files
committed
Include query files in Rust bindings
We're already exposing the grammar definition and metadata as static strings. Compared to that, the query files are tiny enough to include too.
1 parent c0c2aec commit 3ab62e0

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ build = "bindings/rust/build.rs"
1717
include = [
1818
"bindings/rust/*",
1919
"grammar.js",
20+
"queries/*",
2021
"src/*",
2122
]
2223

bindings/rust/lib.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,26 @@ pub fn language() -> Language {
4646
/// The source of the JavaScript tree-sitter grammar description.
4747
pub const GRAMMAR: &'static str = include_str!("../../grammar.js");
4848

49+
/// The syntax highlighting queries for this language.
50+
pub const HIGHLIGHT_QUERIES: &'static str = include_str!("../../queries/highlights.scm");
51+
52+
/// The syntax highlighting queries for languages injected into this one.
53+
pub const INJECTION_QUERIES: &'static str = include_str!("../../queries/injections.scm");
54+
55+
/// The syntax highlighting queries for JSX.
56+
pub const JSX_HIGHLIGHT_QUERIES: &'static str = include_str!("../../queries/highlights-jsx.scm");
57+
58+
/// The local-variable syntax highlighting queries for this language.
59+
pub const LOCALS_QUERIES: &'static str = include_str!("../../queries/locals.scm");
60+
4961
/// The content of the [`node-types.json`][] file for this grammar.
5062
///
5163
/// [`node-types.json`]: https://tree-sitter.github.io/tree-sitter/using-parsers#static-node-types
5264
pub const NODE_TYPES: &'static str = include_str!("../../src/node-types.json");
5365

66+
/// The symbol tagging queries for this language.
67+
pub const TAGGING_QUERIES: &'static str = include_str!("../../queries/tags.scm");
68+
5469
#[cfg(test)]
5570
mod tests {
5671
#[test]

0 commit comments

Comments
 (0)