tree-sitter-tags

Usage

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

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:

```rust use treesittertags::TagsContext;

let context = TagsContext::new(); ```

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

```rust use treesittertags::TagsConfiguration;

let pythonconfig = TagsConfiguration::new( treesitterpython::language(), treesitterpython::TAGGINGQUERY, "", ).unwrap();

let javascriptconfig = TagsConfiguration::new( treesitterjavascript::language(), treesitterjavascript::TAGGINGQUERY, treesitterjavascript::LOCALS_QUERY, ).unwrap(); ```

Compute code navigation tags for some source code:

```rust let tags = context.generatetags( &javascriptconfig, b"class A { getB() { return c(); } }", None, );

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