highlight

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const DebounceHighlightDuration = 75 * time.Millisecond

Debounce duration for highlighting updates

Variables

This section is empty.

Functions

This section is empty.

Types

type EditorInterface

type EditorInterface interface {
	GetBuffer() buffer.Buffer // Still needed to get the initial bytes
	GetCurrentTree() *sitter.Tree
	UpdateSyntaxHighlights(highlights hl.HighlightResult, tree *sitter.Tree)
	FilePath() string
}

EditorInterface defines methods the highlight manager needs from the editor.

type Manager

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

Manager handles debounced asynchronous syntax highlighting.

func NewManager

func NewManager(editor EditorInterface, highlighter *hl.Highlighter, redrawFunc func()) *Manager

NewManager creates a new highlight manager.

func (*Manager) AccumulateEdit added in v0.1.1

func (m *Manager) AccumulateEdit(edit types.EditInfo)

AccumulateEdit adds an edit to the pending list and triggers/resets the timer.

func (*Manager) ClearHighlights

func (m *Manager) ClearHighlights()

ClearHighlights explicitly clears the syntax highlighting state.

func (*Manager) GetCurrentTree

func (m *Manager) GetCurrentTree() *sitter.Tree

GetCurrentTree gets the current syntax tree (thread-safe).

func (*Manager) GetHighlights

func (m *Manager) GetHighlights() []types.HighlightRegion

func (*Manager) GetHighlightsForLine

func (m *Manager) GetHighlightsForLine(lineNum int) []types.StyledRange

GetHighlightsForLine gets syntax highlights for a line (thread-safe).

func (*Manager) HasHighlights

func (m *Manager) HasHighlights() bool

func (*Manager) HighlightSearchMatches

func (m *Manager) HighlightSearchMatches(term string)

func (*Manager) Shutdown added in v0.1.1

func (m *Manager) Shutdown()

Shutdown cancels any pending/running tasks.

func (*Manager) UpdateHighlights

func (m *Manager) UpdateHighlights(newHighlights hl.HighlightResult, newTree *sitter.Tree)

UpdateHighlights updates syntax highlights with thread safety.

Jump to

Keyboard shortcuts

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