Closed FiNEk closed 1 year ago
The dap support added in typescript pack is for JS, per the commit message.
@Uzaaft Sorry, forgot to mention. For testing purposes, i created empty javascript project with npm init -y. Im trying to launch a single .js file with few lines of code. No build process involved, just pure javascript.
works fine for me in a project created with npm init -y
I'm going ahead and closing this. Based upon my testing with astronvim + astrocommunity, DAP + JS works. I've tested on macOS and Linux.
Just a heads up, for anyone landing here from search. I came across this issue and was able to solve it by overwriting pwa-node adapter with host = "127.0.0.1"
{
"mfussenegger/nvim-dap",
opts = function()
local dap = require("dap")
require("dap").adapters["pwa-node"] = {
type = "server",
host = "127.0.0.1",
port = "${port}",
executable = {
command = "node",
args = {
require("mason-registry").get_package("js-debug-adapter"):get_install_path()
.. "/js-debug/src/dapDebugServer.js",
"${port}",
},
},
}
for _, language in ipairs({ "typescript", "javascript" }) do
if not dap.configurations[language] then
dap.configurations[language] = {
{
type = "pwa-node",
request = "launch",
name = "Launch file",
program = "${file}",
cwd = "${workspaceFolder}",
},
{
type = "pwa-node",
request = "attach",
name = "Attach",
processId = require("dap.utils").pick_process,
cwd = "${workspaceFolder}",
},
}
end
end
end,
}
its weird macOS thing where its ipv6 localhost loop somehow denies ipv4 loop. you can either change address in configuration to 127.0.0.1 or you can remove ipv6 loop from your /etc/hosts
Just a heads up, for anyone landing here from search. I came across this issue and was able to solve it by overwriting pwa-node adapter with
host = "127.0.0.1"
{ "mfussenegger/nvim-dap", opts = function() local dap = require("dap") require("dap").adapters["pwa-node"] = { type = "server", host = "127.0.0.1", port = "${port}", executable = { command = "node", args = { require("mason-registry").get_package("js-debug-adapter"):get_install_path() .. "/js-debug/src/dapDebugServer.js", "${port}", }, }, } for _, language in ipairs({ "typescript", "javascript" }) do if not dap.configurations[language] then dap.configurations[language] = { { type = "pwa-node", request = "launch", name = "Launch file", program = "${file}", cwd = "${workspaceFolder}", }, { type = "pwa-node", request = "attach", name = "Attach", processId = require("dap.utils").pick_process, cwd = "${workspaceFolder}", }, } end end end, }
its weird macOS thing where its ipv6 localhost loop somehow denies ipv4 loop. you can either change address in configuration to 127.0.0.1 or you can remove ipv6 loop from your /etc/hosts
I’m also on Mac. How does your default /etc/hosts look?
I’m also on Mac. How does your default /etc/hosts look?
## # Host Database # # localhost is used to configure the loopback interface # when the system is booting. Do not change this entry. ## 127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost
Same as me. So it caused an issue for you, but not for me? That's strange
I agree thats weird, but im sure its not just a single /etc/hosts file. If you really want to dig, then you should compare macOS versions, firewall rules etc etc. All im saying, this is a mac problem and its beyond neovim configuration. Case closed, solution found.
Typescript pack got updated with DAP support, but i cant get it working. Opening debugger UI and trying to launch a debugger with F5 gives me this message
[debug-adapter stdout] Debug server listening at 127.0.0.1:58449
shortly after i get a popup saying thatDAP: Couldn't connect to localhost:${port}: ECONNREFUSED
my config https://github.com/FiNEk/astro_nvim