do not panic on error response to workspace/configuration (#747)

This commit is contained in:
Ingo Lohmar 2022-11-13 23:28:00 +01:00 committed by GitHub
parent 28adef42c1
commit e98aea61ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2644,6 +2644,7 @@ pub fn processJsonRpc(server: *Server, writer: anytype, json: []const u8) !void
// Yes, String ids are officially supported by LSP // Yes, String ids are officially supported by LSP
// but not sure how standard this "standard" really is // but not sure how standard this "standard" really is
if (tree.root.Object.get("error")) |_| return;
const result = tree.root.Object.get("result").?.Array; const result = tree.root.Object.get("result").?.Array;
inline for (std.meta.fields(Config)) |field, index| { inline for (std.meta.fields(Config)) |field, index| {
@ -2661,8 +2662,7 @@ pub fn processJsonRpc(server: *Server, writer: anytype, json: []const u8) !void
if (s.len == 0) { if (s.len == 0) {
if (field.field_type == ?[]const u8) { if (field.field_type == ?[]const u8) {
break :blk null; break :blk null;
} } else {
else {
break :blk s; break :blk s;
} }
} }