refactor: output LSP client messages to log

Regular message only if lsp_output "verbose".
This commit is contained in:
CJ van den Berg 2025-08-20 21:15:38 +02:00
parent 69ea495495
commit 21bd1e58a8
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
2 changed files with 16 additions and 6 deletions

View file

@ -1562,6 +1562,13 @@ fn show_or_log_message(self: *Self, operation: enum { show, log }, params_cb: []
self.logger_lsp.print("{s}: {s}", .{ @tagName(operation), msg });
}
pub fn show_notification(self: *Self, method: []const u8, params_cb: []const u8) !void {
if (!tp.env.get().is("lsp_verbose")) return;
const params = try cbor.toJsonAlloc(self.allocator, params_cb);
defer self.allocator.free(params);
self.logger_lsp.print("LSP notification: {s} -> {s}", .{ method, params });
}
pub fn register_capability(self: *Self, from: tp.pid_ref, cbor_id: []const u8, params_cb: []const u8) ClientError!void {
_ = params_cb;
return LSP.send_response(self.allocator, from, cbor_id, null) catch error.ClientFailed;