Skip to content

Commit c721e71

Browse files
committed
Add "remark" diagnostics
The Swift compiler (and most LLVM-based tools) have a "remark" diagnostic severity. Add support for it into DiagnosticSeverity.
1 parent 34c4d18 commit c721e71

File tree

4 files changed

+11
-0
lines changed

4 files changed

+11
-0
lines changed

Sources/SwiftCompilerPluginMessageHandling/Diagnostics.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ extension PluginMessage.Diagnostic.Severity {
5353
case .error: self = .error
5454
case .warning: self = .warning
5555
case .note: self = .note
56+
case .remark: self = .remark
5657
}
5758
}
5859
}

Sources/SwiftCompilerPluginMessageHandling/PluginMessages.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ public enum PluginMessage {
155155
case error
156156
case warning
157157
case note
158+
case remark
158159
}
159160
public struct Position: Codable {
160161
public var fileName: String

Sources/SwiftDiagnostics/DiagnosticsFormatter.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,10 @@ public struct DiagnosticsFormatter {
341341
case .note:
342342
severityText = "note"
343343
severityAnnotation = .noteText
344+
345+
case .remark:
346+
severityText = "remark"
347+
severityAnnotation = .remarkText
344348
}
345349

346350
let prefix = colorizeIfRequested("\(severityText): ", annotation: severityAnnotation)
@@ -439,4 +443,8 @@ struct ANSIAnnotation {
439443
static var noteText: ANSIAnnotation {
440444
ANSIAnnotation(color: .default, trait: .bold)
441445
}
446+
447+
static var remarkText: ANSIAnnotation {
448+
ANSIAnnotation(color: .blue, trait: .bold)
449+
}
442450
}

Sources/SwiftDiagnostics/Message.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public enum DiagnosticSeverity {
3030
case error
3131
case warning
3232
case note
33+
case remark
3334
}
3435

3536
/// Types conforming to this protocol represent diagnostic messages that can be

0 commit comments

Comments
 (0)