pub fn line_spans(line: &str) -> Vec<StyledSpan>Expand description
Syntax-highlight one *messages* line.
The mode owns this, not a renderer. The TUI used to compose message
bodies itself, behind if is_messages_buffer, and GPUI had no equivalent —
so the log was coloured in one renderer and plain in the other. A
kind-specific body composer in a renderer is the shape the architecture
rules forbid, and the TUI’s own comment said so (“the deeper issue is that
this branch exists at all”). Emitting renderer-neutral [StyledSpan]s
through the synthetic-highlight pipeline is what makes both peers agree
without either of them knowing what a log line is.
The styles are the Messages* family, which resolves to the
messages.timestamp / messages.error / … theme elements that already
exist and that a user can already set. Folding them into the Diagnostic*
colours would have been fewer variants and would have silently orphaned
that vocabulary. Both renderers resolve the family through the one
theme_style map, so neither needs an arm of its own.
Returns an empty vec for a line that is not a record; the renderer then paints it plain, which is what an unparseable line should look like.