From b197b1235b29a28a3844697546e7bf5f65a0ae95 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Fri, 19 Apr 2024 22:06:15 +0200 Subject: [PATCH] fix: add timeout to synchronous language server calls Otherwise if language server does not respond then we effectively hang. --- src/LSP.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/LSP.zig b/src/LSP.zig index 3674af7..eb58b10 100644 --- a/src/LSP.zig +++ b/src/LSP.zig @@ -33,7 +33,7 @@ pub fn send_request(self: Self, a: std.mem.Allocator, method: []const u8, m: any var cb = std.ArrayList(u8).init(self.a); defer cb.deinit(); cbor.writeValue(cb.writer(), m) catch |e| return tp.exit_error(e); - return self.pid.call(a, .{ "REQ", method, cb.items }) catch |e| return tp.exit_error(e); + return self.pid.call(a, std.time.ns_per_s / 2, .{ "REQ", method, cb.items }) catch |e| return tp.exit_error(e); } pub fn send_notification(self: Self, method: []const u8, m: anytype) tp.result {