tree-sitter-language-pack — Elixir
Elixir bindings for tree-sitter-language-pack with on-demand parser downloads.
Installation
{:tree_sitter_language_pack, "~> 1.0"}Quick Start
# Optional: Pre-download specific languages for offline use
TreeSitterLanguagePack.init(["python", "elixir", "javascript"])
# List all available languages
TreeSitterLanguagePack.available_languages()
# Check if a language exists
TreeSitterLanguagePack.has_language("python")
# Auto-downloads language if not cached
ptr = TreeSitterLanguagePack.get_language_ptr("python")
# Pre-download languages for offline use
TreeSitterLanguagePack.download(["python", "javascript"])
result = TreeSitterLanguagePack.process(source, ~s({"language":"elixir"}))
IO.inspect(result)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
Language Detection
detect_language(path)-- detect language from file pathdetect_language_from_content(content)-- detect language from shebang lineextension_ambiguity(ext)-- check if an extension is ambiguous (returns assigned language + alternatives)
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
Syntax Highlighting Queries
get_highlights_query(language)-- get bundled highlights.scm query for a languageget_injections_query(language)-- get bundled injections.scm queryget_locals_query(language)-- get bundled locals.scm query
For full documentation, see kreuzberg.dev.
License
MIT -- see LICENSE for details.
Part of tree-sitter-language-pack -- A comprehensive collection of tree-sitter language parsers with polyglot bindings.