struct EditorDecoration
Swift
struct EditorDecoration
A diagnostic attached to a range of EditorView's bound text.
range is character offsets (matching TextEditingState's own indexing),
not String.Index — indices aren't Sendable or stable across edits,
offsets from a fresh parse always are.
Sources/LavaUI/EditorView.swift:107
Constructors
init(range: Range<Int>, severity: DiagnosticSeverity = .error, underline: DecorationUnderline = .wavy, gutterIcon: String? = nil, color: Color? = nil, message: String? = nil)
Creates a decoration. nil colour and icon take the severity's defaults.
Sources/LavaUI/EditorView.swift:124
Properties
var color: Color?
Colour of the underline and gutter icon, or nil for the severity's default.
Sources/LavaUI/EditorView.swift:118
var gutterIcon: String?
Text drawn in the gutter of the range's first row, or nil for the severity's default.
Sources/LavaUI/EditorView.swift:116
var message: String?
The diagnostic's text. The editor does not draw it; it is for the app, for
instance in onDecorationTap.
Sources/LavaUI/EditorView.swift:121
var range: Range<Int>
The decorated characters, as character offsets into the editor's text.
Sources/LavaUI/EditorView.swift:109
var severity: DiagnosticSeverity
How serious it is. Decides the default colour and gutter icon and, when several decorations share a row, which one the gutter shows.
Sources/LavaUI/EditorView.swift:112
var underline: DecorationUnderline
How the range is underlined.
Sources/LavaUI/EditorView.swift:114