#tree-sitter #json #collector #kind #name

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

#1473 in Procedural macros

Download history 171/week @ 2024-08-09 1452/week @ 2024-08-16 1044/week @ 2024-08-23 923/week @ 2024-08-30 855/week @ 2024-09-06 1495/week @ 2024-09-13 706/week @ 2024-09-20 809/week @ 2024-09-27 748/week @ 2024-10-04

3,910 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
~34K SLoC