Files
Lyrebird/LiveCompile/Sources/LyrebirdLiveCompileUI/ScratchConsoleEntry.swift
T
josh 8519cabe42 v1.4.2 release: live-coding editor — Run Selection, slot release, engine panel, console, manual completion
Additive conveniences to the macOS-only Live Scratch editor. No changes to
existing public API.

- Run Selection (⌘E): evaluate just the highlighted text, additively.
- Graceful slot release: context.release(slot:) / free(slot:).
- Engine panel: live oscilloscope (ScopeCapture) + CPU avg/peak + counts.
- Reset Session / Restart to Reclaim Memory.
- Always-open console panel (report messages + errors with line:col).
- Faster typing: debounced highlight, updateNSView fast-path, publish guards.
- Manual code completion (Esc / F5), no auto-trigger on `.`; completion
  replaces the partial word, not the receiver expression.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-21 11:09:30 -07:00

43 lines
1.1 KiB
Swift

// ScratchConsoleEntry.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
// LyrebirdUI/LiveCompile
//
// One line in the scratch editor's console panel — a report message, an error,
// or a run notice.
#if os(macOS)
/// A single entry in the always-open console.
public struct ScratchConsoleEntry: Identifiable, Equatable {
/// What kind of line this is, for coloring.
public enum Kind: Equatable {
/// `context.reportMessage(_:)` output (and host notices).
case message
/// A compile / DSL error.
case error
/// A run outcome / informational notice.
case info
}
/// Monotonic id (also the display order).
public let id: Int
public let kind: Kind
public let text: String
/// `"line:col"` for an error with a known source position, else `nil`.
public let location: String?
public init(id: Int, kind: Kind, text: String, location: String? = nil) {
self.id = id
self.kind = kind
self.text = text
self.location = location
}
}
#endif