Skip to content

Commit

Permalink
add more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
jbyuki committed May 21, 2024
1 parent 0dd306e commit 9bcfcf3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lua/osv/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ function M.unfreeze()
end

function sendProxyDAP(data)
log(vim.inspect(data))
vim.fn.rpcnotify(nvim_server, 'nvim_exec_lua', [[require"osv".sendDAP(...)]], {data})
end

Expand Down Expand Up @@ -1328,10 +1327,12 @@ end
function M.sendDAP(msg)
local succ, encoded = pcall(vim.fn.json_encode, msg)

log(vim.inspect(msg))
if succ then
local bin_msg = "Content-Length: " .. string.len(encoded) .. "\r\n\r\n" .. encoded

client:write(bin_msg)

else
log(encoded)
end
Expand Down
1 change: 0 additions & 1 deletion src/handlers/set_breakpoints.lua.t
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ local sendProxyDAP

@implement+=
function sendProxyDAP(data)
log(vim.inspect(data))
vim.fn.rpcnotify(nvim_server, 'nvim_exec_lua', [[require"osv".sendDAP(...)]], {data})
end

Expand Down
4 changes: 4 additions & 0 deletions src/send.lua.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
@implement+=
function M.sendDAP(msg)
@encode_json
@log_send_dap
if succ then
@append_content_length
@send_dap_to_client
Expand All @@ -18,3 +19,6 @@ local bin_msg = "Content-Length: " .. string.len(encoded) .. "\r\n\r\n" .. encod

@send_dap_to_client+=
client:write(bin_msg)

@log_send_dap+=
log(vim.inspect(msg))

0 comments on commit 9bcfcf3

Please sign in to comment.