Open maibarra opened 1 year ago
Looks like it is trying to attach to a debug server. What was your typescript/node server running on? You need to run a node process with --inspect-brk flag when doing the attach. When you do that you will see the servers ip and port. In your dap configuration you then can specify that port and url.
For example: nodemode node -r ts-node/register --inspect-brk src/index.ts which starts the server and reloads with nodemon on changes and will ouput the following Debugger listening on ws://127.0.0.1:9229 Leave this running.
Then in another shell/terminal start neovim try to connect using the attach method. This should bring up a list of processes, type in node and you should see a process that is running your server above.
The dap.configuration you use should have the proper keys and values
url = "ws://127.0.0.1:9229",
port = 9229,
Your url and port will differ. Those valuse come from your debug server you started above.
Thanks for the reply @phortonssf
When I attempt to run the node -r ts-node/register --inspect-brk src/index.ts
command on the shell, and start nvim on another tab, I get the following:
Error executing luv callback:
...s/maibarra/.local/share/nvim/lazy/nvim-dap/lua/dap/rpc.lua:81: ...s/maibarra/.local/share/nvim/lazy/nvim-dap/lua/dap/rpc.lua:23: Content-Length not found in headers
. "Content-Type: text/html; charset=UTF-8"
stack traceback:
[C]: in function 'parse_chunk'
...s/maibarra/.local/share/nvim/lazy/nvim-dap/lua/dap/rpc.lua:81: in function <...s/maibarra/.local/share/nvim/lazy/nvim-dap/lua/dap/rpc.lua:67>
The closest thing to a dap.configuration i have is: lua/custom/configs/dap.lua
and it contains:
local dap = require("dap")
dap.adapters["pwa-node"] = {
type = "server",
host = "127.0.0.1",
port = 9229,
executable = {
command = "js-debug-adapter",
}
}
for _, language in ipairs{ "typescript", "javascript" } do
dap.configurations[language] = {
{
type = "pwa-node",
request = "launch",
name = "Launch file",
program = "${file}",
cwd = "${workspaceFolder}",
runtimeExecutable = "node",
},
}
end
Am I missing something?
I am getting the following error message when attempting to start the debugger through
<Leader>db , <Leader>dr
Result:<Leader>db
✅ correctly marks the debugging line<Leader>dr
gets the following:Is there a clean implementation of what I've attempted?
I also tried adding
$HOME/.local/share/nvim/mason/bin
to myPATH
, but that did nothing.Here's what my
~/.config/nvim/lua/custom/plugins.lua
looks like:Here's what my
~/.config/nvim/lua/custom/config/dap.lua
looks like:Here's what my
~/.config/nvim/lua/custom/config/lspconfig.lua
looks like: