src.elv.shsrc.elv.sh/pkg/edit/highlight Index | Files

package highlight

import "src.elv.sh/pkg/edit/highlight"

Package highlight provides an Elvish syntax highlighter.

Index

Types

type Config

type Config struct {
	Check      func(n parse.Tree) (string, []*eval.CompilationError)
	HasCommand func(name string) bool
	AutofixTip func(autofix string) ui.Text
}

Config keeps configuration for highlighting code.

type Highlighter

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

Highlighter is a code highlighter that can deliver results asynchronously.

func NewHighlighter

func NewHighlighter(cfg Config) *Highlighter

func (*Highlighter) Get

func (hl *Highlighter) Get(code string) (ui.Text, []ui.Text)

Get returns the highlighted code and static errors found in the code as tips.

func (*Highlighter) InvalidateCache

func (hl *Highlighter) InvalidateCache()

InvalidateCache invalidates the cached highlighting result.

func (*Highlighter) LateUpdates

func (hl *Highlighter) LateUpdates() <-chan struct{}

LateUpdates returns a channel for notifying late updates.

Source Files

highlight.go highlighter.go regions.go theme.go

Version
v0.21.0 (latest)
Published
Aug 13, 2024
Platform
linux/amd64
Imports
9 packages
Last checked
1 day ago

Tools for package owners.