41 releases

0.26.8 Mar 31, 2026
0.26.6 Feb 25, 2026
0.26.3 Dec 13, 2025
0.25.10 Sep 22, 2025
0.2.0 May 12, 2020

#135 in Text editors

Download history 3154/week @ 2025-12-29 4322/week @ 2026-01-05 4996/week @ 2026-01-12 4816/week @ 2026-01-19 5276/week @ 2026-01-26 6350/week @ 2026-02-02 7324/week @ 2026-02-09 6838/week @ 2026-02-16 7414/week @ 2026-02-23 10069/week @ 2026-03-02 8609/week @ 2026-03-09 7947/week @ 2026-03-16 7383/week @ 2026-03-23 9881/week @ 2026-03-30 8205/week @ 2026-04-06 11576/week @ 2026-04-13

37,793 downloads per month
Used in 42 crates (8 directly)

MIT license

715KB
17K SLoC

C 12K SLoC // 0.1% comments Rust 5K SLoC // 0.0% comments

Tree-sitter Tags

crates.io badge

Usage

Add this crate, and the language-specific crates for whichever languages you want to parse, to your Cargo.toml:

[dependencies]
tree-sitter-tags = "0.19"
tree-sitter-javascript = "0.19"
tree-sitter-python = "0.19"

Create a tag context. You need one of these for each thread that you're using for tag computation:

use tree_sitter_tags::TagsContext;

let context = TagsContext::new();

Load some tagging queries from the queries directory of some language repositories:

use tree_sitter_tags::TagsConfiguration;

let python_config = TagsConfiguration::new(
    tree_sitter_python::language(),
    tree_sitter_python::TAGGING_QUERY,
    "",
).unwrap();

let javascript_config = TagsConfiguration::new(
    tree_sitter_javascript::language(),
    tree_sitter_javascript::TAGGING_QUERY,
    tree_sitter_javascript::LOCALS_QUERY,
).unwrap();

Compute code navigation tags for some source code:

let tags = context.generate_tags(
    &javascript_config,
    b"class A { getB() { return c(); } }",
    None,
);

for tag in tags {
    println!("kind: {:?}", tag.kind);
    println!("range: {:?}", tag.range);
    println!("name_range: {:?}", tag.name_range);
    println!("docs: {:?}", tag.docs);
}

Dependencies

~2.2–4MB
~75K SLoC