tree-sitter-language-pack — Rust
Rust core library providing access to 170+ tree-sitter parsers with on-demand download and caching support.
Installation
Quick Start
use ;
// Initialize and download specific languages (optional)
init.unwrap;
// Get a language (auto-downloads if needed)
let lang = get_language.unwrap;
// Get a pre-configured parser
let mut parser = get_parser.unwrap;
let tree = parser.parse.unwrap;
println!;
// List all available languages
for lang in available_languages
// Process source code (auto-downloads language if needed)
let config = new.all;
let result = process.unwrap;
println!;
println!;
// Pre-download languages for offline use
download.unwrap;
// With chunking
let config = new.all.with_chunking;
let result = process.unwrap;
println!;
Features
| Feature | Description |
|---|---|
| 170+ Languages | Pre-compiled parsers for 170+ programming languages |
| On-Demand Downloads | Parsers are downloaded on-demand and cached locally for fast reuse |
| Selective Installation | Download only the languages you need; unused parsers never downloaded |
| Polyglot Bindings | Native bindings for Rust, Python, Node.js, Go, Java, Elixir, and C/C++ |
| Automatic Caching | Downloaded parsers cached in platform-specific directories for offline use |
| Feature Groups | Curated language sets: web, systems, scripting, data, jvm, functional |
Feature Groups
Enable curated language sets instead of individual languages:
[]
= { = "1.0.0-rc.1", = false, = ["web"] }
Available groups: all (default), web, systems, scripting, data, jvm, functional.
API Reference
Language Discovery
available_languages()-- list all supported language nameshas_language(name)-- check if a language is availablelanguage_count()-- total number of supported languages
Parsing
get_parser(name)/parse_string(source, language)-- parse source code into a syntax tree
Download API
init(languages)-- pre-download specific languages for offline usedownload(languages)-- download parsers on demand
Intelligence
process(source, config)-- extract structured analysis (functions, classes, imports, comments, chunks) from source code
For detailed API documentation, see the Rust package.
License
MIT -- see LICENSE for details.
Part of tree-sitter-language-pack -- A comprehensive collection of tree-sitter language parsers with polyglot bindings.