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.
41 lines
1021 B
Go
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) {}
|