treesitter

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LangaugeUnknown = "unknown"
	LanguageHTML    = "html"
	LanguagePhp     = "php"
	LanguagePhpOnly = "php_only"
	LanguageBlade   = "blade"
	LanguageDotEnv  = "dotenv"
)

Constants for all treesitter languages that are supported

Variables

This section is empty.

Functions

func CalculateEdit

func CalculateEdit(start, end ts.Point, oldSrc []byte, newSrc []byte) *ts.InputEdit

Calculate a treesitter InputEdit object.

func CalculateNewEndPoint

func CalculateNewEndPoint(start ts.Point, src []byte) ts.Point

Calculate a new endpoint

func FiletypeToLanguage

func FiletypeToLanguage(t file.Type) string

Get the language for a particular filetype

func FirstNamedChild

func FirstNamedChild(node *ts.Node) *ts.Node

func FirstNamedChildOfKind

func FirstNamedChildOfKind(node *ts.Node, kind string) *ts.Node

func GetLanguage

func GetLanguage(lang string) *ts.Language

func GetRowByte

func GetRowByte(row uint, src []byte) uint

Get the byte count at an specific row.

func NamedChildOfKind

func NamedChildOfKind(node *ts.Node, kind string) *ts.Node

func PointInRange

func PointInRange(p ts.Point, r ts.Range) bool

Returns true if point p is inside range r

func PointToByteOffset

func PointToByteOffset(point ts.Point, src []byte) uint

Get the byte offset for a point.

func RangeOverlap

func RangeOverlap(a ts.Range, b ts.Range) bool

Returns true if range a and b overlaps. (calculated using point fields)

func RangeOverlapBytes

func RangeOverlapBytes(a ts.Range, b ts.Range) bool

Returns true if range a and b overlaps (calculated using byte fields)

Types

type Capture

type Capture struct {
	Name string
	Node ts.Node
}

type CaptureSlice

type CaptureSlice []Capture

func (CaptureSlice) At

func (captures CaptureSlice) At(position ts.Point) *ts.Node

Find a capture at a given position

func (CaptureSlice) In

func (captures CaptureSlice) In(r ts.Range) []*ts.Node

Find all captures in a given range

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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