Gim/internal/syntax/plain.go
Hayden Hargreaves 16d1318c22 feat: start TS impl
This is so vibe coded, but in the interest of time, its a bit
necessary. Plus this is a complex problem that I don't have the mental
bandwidth to invest right now.
2026-04-07 10:23:25 -07:00

41 lines
1021 B
Go

package syntax
import (
"git.gophernest.net/azpect/TextEditor/internal/core"
"git.gophernest.net/azpect/TextEditor/internal/style"
"github.com/charmbracelet/lipgloss"
)
// PlainEngine is a no-op syntax engine.
// It exists to establish the architecture boundary before Tree-sitter is wired in.
type PlainEngine struct {
styles style.Styles
}
func NewPlainEngine(styles style.Styles) *PlainEngine {
return &PlainEngine{styles: styles}
}
func (e *PlainEngine) PrepareBuffer(buf *core.Buffer) {}
func (e *PlainEngine) ApplyEdit(buf *core.Buffer, edit *core.BufferEdit) {}
func (e *PlainEngine) LineStyleMap(buf *core.Buffer, line int) []lipgloss.Style {
if buf == nil {
return nil
}
text := buf.Line(line)
runes := []rune(text)
styleMap := make([]lipgloss.Style, len(runes))
for i := range styleMap {
styleMap[i] = e.styles.LineStyle
}
return styleMap
}
func (e *PlainEngine) InvalidateBuffer(buf *core.Buffer) {}
func (e *PlainEngine) InvalidateLines(buf *core.Buffer, startLine, endLine int) {}