feat: respond to client/registerCapability requests with a null result

This commit is contained in:
CJ van den Berg 2024-09-05 21:57:17 +02:00
parent 79ba5d32cd
commit 2060588a28
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
2 changed files with 22 additions and 7 deletions

View file

@ -749,6 +749,18 @@ pub fn show_message(_: *Self, _: tp.pid_ref, params_cb: []const u8) !void {
logger.print("{s}", .{msg});
}
pub fn register_capability(self: *Self, from: tp.pid_ref, id: i32, params_cb: []const u8) !void {
_ = params_cb;
return self.send_lsp_response(from, id, null);
}
pub fn send_lsp_response(self: *Self, from: tp.pid_ref, id: i32, result: anytype) !void {
var cb = std.ArrayList(u8).init(self.allocator);
defer cb.deinit();
try cbor.writeValue(cb.writer(), result);
return from.send(.{ "RSP", id, cb.items });
}
fn send_lsp_init_request(self: *Self, lsp: LSP, project_path: []const u8, project_basename: []const u8, project_uri: []const u8) !tp.message {
return lsp.send_request(self.allocator, "initialize", .{
.processId = if (builtin.os.tag == .linux) std.os.linux.getpid() else null,