treesitter

package
v1.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

Package treesitter provides a shared grammar registry for tree-sitter languages. Both the edit package (BodyExtractor) and repomap package (TagExtractor) consume this registry to avoid duplicating grammar initialization.

Index

Constants

View Source
const Available = true

Available reports whether tree-sitter parsing is compiled into this binary. Resolved at compile time via build tags.

Variables

This section is empty.

Functions

This section is empty.

Types

type GrammarRegistry

type GrammarRegistry struct {
	// contains filtered or unexported fields
}

GrammarRegistry holds tree-sitter language grammars keyed by language name. Thread-safe for concurrent reads.

func NewGrammarRegistry

func NewGrammarRegistry() *GrammarRegistry

NewGrammarRegistry creates a GrammarRegistry with Go, Python, TypeScript, TSX, and Rust grammars.

func (*GrammarRegistry) GetLanguage

func (r *GrammarRegistry) GetLanguage(lang string) (*tree_sitter.Language, bool)

GetLanguage returns the tree-sitter language for the given language name. Returns (nil, false) if the language is not registered.

func (*GrammarRegistry) SupportedLanguages

func (r *GrammarRegistry) SupportedLanguages() []string

SupportedLanguages returns a sorted slice of all registered language names.

func (*GrammarRegistry) SupportsLanguage

func (r *GrammarRegistry) SupportsLanguage(lang string) bool

SupportsLanguage returns true if the registry has a grammar for the given language.

Directories

Path Synopsis
bindings
r

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL