treesitter

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: AGPL-3.0 Imports: 20 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package treesitter wires the vdb-manager language identifiers used in x_treeSitterQueries.language to concrete tree-sitter grammars bundled via github.com/smacker/go-tree-sitter.

The CLI links every supported grammar statically through CGo. Cross- compilation requires a C toolchain capable of targeting each GOOS/GOARCH (see justfile: `zig cc`).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Extensions

func Extensions(id LanguageID) []string

Extensions returns the file extensions associated with a language. The dot is included (e.g. ".py"). Returned slices must not be mutated.

func Grammar

func Grammar(id LanguageID) *sitter.Language

Grammar resolves a vdb-manager language identifier to a tree-sitter grammar. Returns nil if the language is not bundled.

Types

type LanguageID

type LanguageID string

LanguageID is the canonical identifier emitted by vdb-manager in the TreeSitterQuery.Language field. The set is fixed; new languages must be added in both vdb-manager and here.

const (
	LangJavaScript LanguageID = "javascript"
	LangTypeScript LanguageID = "typescript"
	LangTSX        LanguageID = "tsx"
	LangPython     LanguageID = "python"
	LangGo         LanguageID = "go"
	LangJava       LanguageID = "java"
	LangRuby       LanguageID = "ruby"
	LangRust       LanguageID = "rust"
	LangC          LanguageID = "c"
	LangCPP        LanguageID = "cpp"
	LangCSharp     LanguageID = "c-sharp"
	LangPHP        LanguageID = "php"
	LangSwift      LanguageID = "swift"
	LangKotlin     LanguageID = "kotlin"
	LangScala      LanguageID = "scala"
	LangBash       LanguageID = "bash"
	LangLua        LanguageID = "lua"
)

func All

func All() []LanguageID

All returns every bundled language identifier in declaration order.

func LanguageForPath

func LanguageForPath(path string) LanguageID

LanguageForPath returns the language ID a path's extension maps to, or empty if no bundled grammar handles it. Casing is normalised.

func Normalise

func Normalise(raw string) LanguageID

Normalise accepts user/server identifiers in any of the several spellings used in the wild (golang vs go, c-sharp vs csharp, etc.) and returns the canonical LanguageID, or empty if unknown.

Jump to

Keyboard shortcuts

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