Fix CI?
I really need to fix Zig's error handling on message send failure, it's so bad 😭
This commit is contained in:
parent
acd57ddb16
commit
37f79c86fa
@ -33,8 +33,6 @@ for (const line of lines) {
|
|||||||
const type = line.split(":")[1].split("=")[0].trim();
|
const type = line.split(":")[1].split("=")[0].trim();
|
||||||
const defaultValue = line.split(":")[1].split("=")[1].trim().replace(",","");
|
const defaultValue = line.split(":")[1].split("=")[1].trim().replace(",","");
|
||||||
|
|
||||||
// console.log(name, type, defaultValue);
|
|
||||||
|
|
||||||
console.log(`"zls.${name}": ${JSON.stringify({
|
console.log(`"zls.${name}": ${JSON.stringify({
|
||||||
"scope": "resource",
|
"scope": "resource",
|
||||||
"type": mapType(type),
|
"type": mapType(type),
|
||||||
|
@ -1756,6 +1756,7 @@ fn initializeHandler(arena: *std.heap.ArenaAllocator, id: types.RequestId, req:
|
|||||||
fn registerCapability(arena: *std.heap.ArenaAllocator, method: []const u8) !void {
|
fn registerCapability(arena: *std.heap.ArenaAllocator, method: []const u8) !void {
|
||||||
// NOTE: stage1 moment occurs if we dont do it like this :(
|
// NOTE: stage1 moment occurs if we dont do it like this :(
|
||||||
// long live stage2's not broken anon structs
|
// long live stage2's not broken anon structs
|
||||||
|
|
||||||
logger.debug("Dynamically registering method '{s}'", .{method});
|
logger.debug("Dynamically registering method '{s}'", .{method});
|
||||||
|
|
||||||
const id = try std.fmt.allocPrint(arena.allocator(), "register-{s}", .{method});
|
const id = try std.fmt.allocPrint(arena.allocator(), "register-{s}", .{method});
|
||||||
@ -1778,8 +1779,6 @@ fn registerCapability(arena: *std.heap.ArenaAllocator, method: []const u8) !void
|
|||||||
.params = respp,
|
.params = respp,
|
||||||
};
|
};
|
||||||
|
|
||||||
std.log.info("AAAAA {s}", .{req});
|
|
||||||
|
|
||||||
try send(arena, req);
|
try send(arena, req);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2241,10 +2240,8 @@ fn processJsonRpc(arena: *std.heap.ArenaAllocator, parser: *std.json.Parser, jso
|
|||||||
else => types.RequestId{ .Integer = 0 },
|
else => types.RequestId{ .Integer = 0 },
|
||||||
} else types.RequestId{ .Integer = 0 };
|
} else types.RequestId{ .Integer = 0 };
|
||||||
|
|
||||||
if (id == .String and std.mem.startsWith(u8, id.String, "register")) {
|
if (id == .String and std.mem.startsWith(u8, id.String, "register"))
|
||||||
logger.info("INFO!!! {s}", .{json});
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
if (id == .String and std.mem.eql(u8, id.String, "i_haz_configuration")) {
|
if (id == .String and std.mem.eql(u8, id.String, "i_haz_configuration")) {
|
||||||
logger.info("Setting configuration...", .{});
|
logger.info("Setting configuration...", .{});
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ const Server = struct {
|
|||||||
const rest = response_bytes[json_fmt.len..];
|
const rest = response_bytes[json_fmt.len..];
|
||||||
const id_end = std.mem.indexOfScalar(u8, rest, ',') orelse return error.InvalidResponse;
|
const id_end = std.mem.indexOfScalar(u8, rest, ',') orelse return error.InvalidResponse;
|
||||||
|
|
||||||
const id = try std.fmt.parseInt(u32, rest[0..id_end], 10);
|
const id = std.fmt.parseInt(u32, rest[0..id_end], 10) catch continue;
|
||||||
|
|
||||||
if (id != self.request_id) {
|
if (id != self.request_id) {
|
||||||
continue;
|
continue;
|
||||||
@ -83,6 +83,7 @@ const Server = struct {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn extractError(msg: []const u8) !void {
|
fn extractError(msg: []const u8) !void {
|
||||||
const log_request =
|
const log_request =
|
||||||
\\"method":"window/logMessage","params":{"type":
|
\\"method":"window/logMessage","params":{"type":
|
||||||
|
Loading…
Reference in New Issue
Block a user