highlight

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CaptureInjectionCombined = "injection.combined"

	CaptureLocal              = "local"
	CaptureLocalScopeInherits = "local.scope-inherits"
)
View Source
const DefaultHighlight = ^uint(0)

Variables

This section is empty.

Functions

func InjectionForMatch

func InjectionForMatch(config types.Configuration, parentName string, query *tree_sitter.Query, match tree_sitter.QueryMatch, source []byte) (string, *tree_sitter.Node, bool)

func IntersectRanges

func IntersectRanges(parentRanges []tree_sitter.Range, nodes []tree_sitter.Node, includesChildren bool) []tree_sitter.Range

Compute the ranges that should be included when parsing an injection. This takes into account three things:

  • `parent_ranges` - The ranges must all fall within the *current* layer's ranges.
  • `nodes` - Every injection takes place within a set of nodes. The injection ranges are the ranges of those nodes.
  • `includes_children` - For some injections, the content nodes' children should be excluded from the nested document, so that only the content nodes' *own* content is reparsed. For other injections, the content nodes' entire ranges should be reparsed, including the ranges of their children.

Types

type Highlighter

type Highlighter struct {
	Parser *tree_sitter.Parser
	// contains filtered or unexported fields
}

Highlighter is a syntax Highlighter that uses tree-sitter to parse source code and apply syntax highlighting. It is not thread-safe.

func (*Highlighter) PopCursor

func (h *Highlighter) PopCursor() *tree_sitter.QueryCursor

func (*Highlighter) PushCursor

func (h *Highlighter) PushCursor(cursor *tree_sitter.QueryCursor)

Source Files

  • captures.go
  • highlight.go

Jump to

Keyboard shortcuts

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