#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

#1564 in Procedural macros

Download history 219/week @ 2024-08-10 1552/week @ 2024-08-17 1030/week @ 2024-08-24 918/week @ 2024-08-31 1074/week @ 2024-09-07 1240/week @ 2024-09-14 708/week @ 2024-09-21 825/week @ 2024-09-28 1059/week @ 2024-10-05 676/week @ 2024-10-12 755/week @ 2024-10-19 760/week @ 2024-10-26 652/week @ 2024-11-02 623/week @ 2024-11-09

2,880 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