lang

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var QueryFS fs.FS

QueryFS is the filesystem interface for accessing embedded queries

Functions

func Initialize

func Initialize()

Initialize ensures the registry is ready for use

func Register

func Register(lang *Language)

Register adds a language to the registry

Types

type Language

type Language struct {
	// Name is the display name of the language
	Name string

	// TreeSitterLang is the tree-sitter language instance
	TreeSitterLang *sitter.Language

	// Extensions maps file extensions to this language
	Extensions []string

	// QueryPath is the path to the highlight query file
	QueryPath string
}

Language represents a programming language with its syntax highlighting configuration

func GetAll

func GetAll() []*Language

GetAll returns all registered languages

func GetForFile

func GetForFile(filePath string) *Language

GetForFile returns the language for a given file path

func (*Language) GetQuery

func (l *Language) GetQuery() []byte

GetQuery loads and returns the highlight query for this language

Jump to

Keyboard shortcuts

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