From e98aea61ea5c5c487100c97786c7763c38236b15 Mon Sep 17 00:00:00 2001 From: Ingo Lohmar Date: Sun, 13 Nov 2022 23:28:00 +0100 Subject: [PATCH] do not panic on error response to workspace/configuration (#747) --- src/Server.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Server.zig b/src/Server.zig index 6cea29c..dc204b4 100644 --- a/src/Server.zig +++ b/src/Server.zig @@ -2644,6 +2644,7 @@ pub fn processJsonRpc(server: *Server, writer: anytype, json: []const u8) !void // Yes, String ids are officially supported by LSP // but not sure how standard this "standard" really is + if (tree.root.Object.get("error")) |_| return; const result = tree.root.Object.get("result").?.Array; 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 (field.field_type == ?[]const u8) { break :blk null; - } - else { + } else { break :blk s; } }