#tree-sitter #json #collector #kind #name #mod #node-types

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

#1645 in Procedural macros

Download history 1057/week @ 2024-08-26 852/week @ 2024-09-02 1388/week @ 2024-09-09 905/week @ 2024-09-16 791/week @ 2024-09-23 756/week @ 2024-09-30 1037/week @ 2024-10-07 662/week @ 2024-10-14 756/week @ 2024-10-21 769/week @ 2024-10-28 635/week @ 2024-11-04 657/week @ 2024-11-11 641/week @ 2024-11-18 587/week @ 2024-11-25 734/week @ 2024-12-02 790/week @ 2024-12-09

2,844 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.5MB
~33K SLoC