Open tadeokondrak opened 1 year ago
Some request results have slices, like textDocument/hover's MarkupContent.
textDocument/hover
When using lsp.Connection, the signature is
lsp.Connection
pub fn @"textDocument/hover"(conn: *Connection, id: lsp.types.RequestId, params: lsp.types.HoverParams) !lsp.types.Hover
If I set up an arena allocator inside the implementation, the memory returned becomes invalid. Is there a simple way to do this without leaking memory?
You should take a look at implementing lspRecvPre and lspRecvPost hooks which will be called before and after your textDocument/hover request.
lspRecvPre
lspRecvPost
https://github.com/ziglibs/zig-lsp/blob/d89ebda52af2db181bfcdb3fba17f7e3e8208984/src/zig_lsp.zig#L314-L320
Some request results have slices, like
textDocument/hover
's MarkupContent.When using
lsp.Connection
, the signature isIf I set up an arena allocator inside the implementation, the memory returned becomes invalid. Is there a simple way to do this without leaking memory?