feat: make the language server request timeout a configurable option
This commit is contained in:
parent
2ae89a14fd
commit
fa23096f85
3 changed files with 5 additions and 2 deletions
|
@ -12,7 +12,6 @@ const Self = @This();
|
|||
const module_name = @typeName(Self);
|
||||
const sp_tag = "child";
|
||||
const debug_lsp = true;
|
||||
const lsp_request_timeout = std.time.ns_per_s * 3;
|
||||
|
||||
const OutOfMemoryError = error{OutOfMemory};
|
||||
const SendError = error{SendFailed};
|
||||
|
@ -36,7 +35,8 @@ pub fn send_request(self: Self, allocator: std.mem.Allocator, method: []const u8
|
|||
var cb = std.ArrayList(u8).init(self.allocator);
|
||||
defer cb.deinit();
|
||||
try cbor.writeValue(cb.writer(), m);
|
||||
return self.pid.call(allocator, lsp_request_timeout, .{ "REQ", method, cb.items });
|
||||
const request_timeout: u64 = @intCast(std.time.ns_per_s * tp.env.get().num("lsp-request-timeout"));
|
||||
return self.pid.call(allocator, request_timeout, .{ "REQ", method, cb.items });
|
||||
}
|
||||
|
||||
pub fn send_response(self: Self, id: i32, m: anytype) SendError!tp.message {
|
||||
|
|
|
@ -23,3 +23,5 @@ tab_width: usize = 8,
|
|||
|
||||
top_bar: []const u8 = "",
|
||||
bottom_bar: []const u8 = "mode file log selection diagnostics linenumber",
|
||||
|
||||
lsp_request_timeout: usize = 3,
|
||||
|
|
|
@ -92,6 +92,7 @@ fn init(allocator: Allocator) !*Self {
|
|||
if (frame_rate != 0)
|
||||
conf.frame_rate = frame_rate;
|
||||
tp.env.get().num_set("frame-rate", @intCast(conf.frame_rate));
|
||||
tp.env.get().num_set("lsp-request-timeout", @intCast(conf.lsp_request_timeout));
|
||||
const frame_time = std.time.us_per_s / conf.frame_rate;
|
||||
const frame_clock = try tp.metronome.init(frame_time);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue