highlight

package
v0.20.1 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: BSD-2-Clause Imports: 8 Imported by: 1

Documentation

Overview

Package highlight provides an Elvish syntax highlighter.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Check      func(n parse.Tree) (string, []diag.RangeError)
	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 added in v0.19.0

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.

Jump to

Keyboard shortcuts

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