1.0.0 release
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
// Diagnostic.swift
|
||||
// Lyrebird
|
||||
//
|
||||
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
// LyrebirdLiveCompile — Phase 144
|
||||
//
|
||||
// One parsed `swiftc` diagnostic, with `line` already mapped from the wrapped-
|
||||
// snippet coordinate space back to the user's snippet coordinate space (via the
|
||||
// `userBodyLineOffset` from `SnippetHarness.wrap(userBody:)`).
|
||||
//
|
||||
// The editor in Phase 145 (`LyrebirdScratchView`) renders diagnostics in its
|
||||
// margin gutter using `(line, column)` directly.
|
||||
|
||||
#if os(macOS)
|
||||
|
||||
public struct Diagnostic: Equatable, Sendable {
|
||||
/// 1-based line number in the **user's** snippet body. May be `nil` when the
|
||||
/// diagnostic landed inside the harness preamble (i.e. the wrapped line
|
||||
/// number is less than `userBodyLineOffset`) — that almost always points at
|
||||
/// the user importing a missing module or otherwise breaking the preamble.
|
||||
public let line: Int?
|
||||
|
||||
/// 1-based column number. swiftc emits the same column for preamble and
|
||||
/// user-body lines, so no translation is needed.
|
||||
public let column: Int
|
||||
|
||||
public let severity: DiagnosticSeverity
|
||||
|
||||
public let message: String
|
||||
|
||||
/// 1-based line number swiftc actually reported, before user-coordinate
|
||||
/// translation. Useful for debugging the parser; not surfaced to end users.
|
||||
public let rawLine: Int
|
||||
|
||||
public init(
|
||||
line: Int?,
|
||||
column: Int,
|
||||
severity: DiagnosticSeverity,
|
||||
message: String,
|
||||
rawLine: Int
|
||||
) {
|
||||
self.line = line
|
||||
self.column = column
|
||||
self.severity = severity
|
||||
self.message = message
|
||||
self.rawLine = rawLine
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user