Now we can load them in via JSON files at launch time. They are embded in the final exe though...
29 lines
968 B
Go
29 lines
968 B
Go
package syntax
|
|
|
|
import (
|
|
"git.gophernest.net/azpect/TextEditor/internal/core"
|
|
"git.gophernest.net/azpect/TextEditor/internal/theme"
|
|
"github.com/charmbracelet/lipgloss"
|
|
)
|
|
|
|
// Engine provides syntax highlight data for buffers.
|
|
//
|
|
// The renderer should consume this interface rather than doing parse/token work
|
|
// directly.
|
|
type Engine interface {
|
|
// Engine.PrepareBuffer: Ensure syntax state for a buffer is ready.
|
|
PrepareBuffer(buf *core.Buffer, t theme.EditorTheme)
|
|
|
|
// Engine.ApplyEdit: Apply an incremental text edit to syntax state.
|
|
ApplyEdit(buf *core.Buffer, edit *core.BufferEdit)
|
|
|
|
// Engine.LineStyleMap: Returns per-rune styles for a line.
|
|
LineStyleMap(buf *core.Buffer, line int, t theme.EditorTheme) []lipgloss.Style
|
|
|
|
// Engine.InvalidateBuffer: Marks all syntax state for a buffer as stale.
|
|
InvalidateBuffer(buf *core.Buffer)
|
|
|
|
// Engine.InvalidateLines: Marks a line range as stale.
|
|
InvalidateLines(buf *core.Buffer, startLine, endLine int)
|
|
}
|