mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-10-06 18:06:33 +00:00
c: remove the config load string API
It was unused and doesn't match our diagnostic API.
This commit is contained in:
@@ -15,31 +15,6 @@ pub const Diagnostic = struct {
|
||||
key: [:0]const u8 = "",
|
||||
message: [:0]const u8,
|
||||
|
||||
/// The possible locations for a diagnostic message. This is used
|
||||
/// to provide context for the message.
|
||||
pub const Location = union(enum) {
|
||||
none,
|
||||
cli: usize,
|
||||
file: struct {
|
||||
path: []const u8,
|
||||
line: usize,
|
||||
},
|
||||
|
||||
pub fn fromIter(iter: anytype) Location {
|
||||
const Iter = t: {
|
||||
const T = @TypeOf(iter);
|
||||
break :t switch (@typeInfo(T)) {
|
||||
.Pointer => |v| v.child,
|
||||
.Struct => T,
|
||||
else => return .none,
|
||||
};
|
||||
};
|
||||
|
||||
if (!@hasDecl(Iter, "location")) return .none;
|
||||
return iter.location() orelse .none;
|
||||
}
|
||||
};
|
||||
|
||||
/// Write the full user-friendly diagnostic message to the writer.
|
||||
pub fn write(self: *const Diagnostic, writer: anytype) !void {
|
||||
switch (self.location) {
|
||||
@@ -61,6 +36,31 @@ pub const Diagnostic = struct {
|
||||
}
|
||||
};
|
||||
|
||||
/// The possible locations for a diagnostic message. This is used
|
||||
/// to provide context for the message.
|
||||
pub const Location = union(enum) {
|
||||
none,
|
||||
cli: usize,
|
||||
file: struct {
|
||||
path: []const u8,
|
||||
line: usize,
|
||||
},
|
||||
|
||||
pub fn fromIter(iter: anytype) Location {
|
||||
const Iter = t: {
|
||||
const T = @TypeOf(iter);
|
||||
break :t switch (@typeInfo(T)) {
|
||||
.Pointer => |v| v.child,
|
||||
.Struct => T,
|
||||
else => return .none,
|
||||
};
|
||||
};
|
||||
|
||||
if (!@hasDecl(Iter, "location")) return .none;
|
||||
return iter.location() orelse .none;
|
||||
}
|
||||
};
|
||||
|
||||
/// A list of diagnostics. The "_diagnostics" field must be this type
|
||||
/// for diagnostics to be supported. If this field is an incorrect type
|
||||
/// a compile-time error will be raised.
|
||||
|
Reference in New Issue
Block a user