#tree-sitter #json #collector

macro treesitter_kind_collector

collect kind names from node-types.json of treesitter

2 unstable releases

0.2.0 Aug 15, 2024
0.1.0 Aug 15, 2024

#1553 in Procedural macros

Download history 400/week @ 2024-08-11 1492/week @ 2024-08-18 1032/week @ 2024-08-25 902/week @ 2024-09-01 1226/week @ 2024-09-08 1065/week @ 2024-09-15 790/week @ 2024-09-22 746/week @ 2024-09-29 1066/week @ 2024-10-06 672/week @ 2024-10-13 749/week @ 2024-10-20

3,399 downloads per month
Used in neocmakelsp

MIT license

7KB
120 lines

treesitter-type-collector

Macro example to generate all kind names in node-types.json, and make them to a mod.

Example:

use treesitter_type_collector::tree_sitter_consts;

#[tree_sitter_consts("asserts/node-types.json")]
struct NodeTypes;

fn main() {
    println!("{}", NodeTypes::KIND_ARGUMENT);
    println!("{:?}", NodeTypes::NODE_TYPES);
}


lib.rs:

Auto transport node_types.json to rust mod

Min example


use treesitter_kind_collector::tree_sitter_kinds;
#[tree_sitter_kinds("asserts/node-types.json")]
struct NodeKindTypes;

fn main() {
    println!("{}", NodeKindTypes::ARGUMENT);
    println!("{:?}", NodeKindTypes::NODE_TYPES);
}

Dependencies

~0.7–1.6MB
~35K SLoC