Closed ChilloManiac closed 1 year ago
This is because the vscode-js-debug have changed in the last release. This plugin assumes it will write the port on stdout but now it writes "Debug server listening at 127.0.0.1:8123" instead.
Seems to me like a refactor in vscode-js-debug changed the executable to src/dapDebugServer.ts, which prints the new message (previously this line i believe). I have a hard time testing this out as mason is broken and doesn't let me install the previous version.
Edit: Here is the change in executable that is installed: https://github.com/mason-org/mason-registry/commit/425b3612fa9d3b844238b575ad712572191a2a58
Mason for some switched to use the new dapDebugServer for 1.77.1 in the minor bump, which I think still is in a WIP state.
Finally got it working again, the new executable of vscode-js-debug is a dap compliant server, and thus we can configure it manually as an adapter in nvim-dap instead of using this plugin, as described here.
For me debugging node (using mason) it looks like this
require("dap").adapters["pwa-node"] = {
type = "server",
host = "localhost",
port = "${port}",
executable = {
command = "js-debug-adapter", -- As I'm using mason, this will be in the path
args = {"${port}"},
}
}
for _, language in ipairs { "typescript", "javascript" } do
require("dap").configurations[language] = {
{
type = "pwa-node",
request = "attach",
name = "Attach to node",
processId = require("dap.utils").pick_process,
cwd = "${workspaceFolder}",
},
}
end
I do not use debugging for Jest but hope this helps!
Thanks for you help - I seemed to have been confused while changing from using Mason and using microsoft/vscode-js-debug to install it.
What worked for me was not including the debug_cmd as i was installing it withou Mason.
So for anyone who comes looking, i:
Thanks for the feedback, you helped me in finding my error
Final config if needed:
local M = {
"mfussenegger/nvim-dap",
dependencies = {
{ "rcarriga/nvim-dap-ui" },
{
"mxsdev/nvim-dap-vscode-js",
tag = "v1.1.0",
},
{
"microsoft/vscode-js-debug",
tag = "v1.74.1",
build =
"npm install --legacy-peer-deps && npx gulp vsDebugServerBundle && mv dist out"
},
},
keys = {
-- Snippet
}
}
M.config = function()
require('dap-vscode-js').setup({
debugger_path = vim.fn.stdpath('data') .. '/lazy/vscode-js-debug',
adapters = { 'pwa-node', 'pwa-chrome', 'pwa-msedge', 'node-terminal', 'pwa-extensionHost' },
})
local dap = require('dap')
-- language config
for _, language in ipairs({ 'typescript', 'javascript' }) do
dap.configurations[language] = {
{
type = "pwa-node",
request = "launch",
name = "Debug Jest Tests",
-- trace = true, -- include debugger info
runtimeExecutable = "node",
runtimeArgs = {
"./node_modules/jest/bin/jest.js",
"--runInBand",
"${file}",
},
rootPath = "${workspaceFolder}",
cwd = "${workspaceFolder}",
console = "integratedTerminal",
internalConsoleOptions = "neverOpen",
port = 8123,
}
}
end
end
return M
@Tiseno i'm still having the same issue using pwa-chrome
addapter, any solution for this ?
Not from me, I do not debug chrome, but if vscode-js-debug dapDebugServer can connect to chrome and you launch chrome with debugging port enabled the solution should be the same as for a node process I would think; manually configure your pwa-chrome adapter and skip this plugin.
This plugin (as i understand it, without having dug too far) was just a compatibility layer for vscode-js-debug as it did not comply to the DAP. But now that it does, it seems obsolete.
Otherwise you would have to install an earlier version of vscode-js-debug as ChilloManiac did.
I've tried to get debugging in jest working but im getting the following error.
Im using
lazy
as a package manager with the following config:I've tried building both nvim-dap-vscode-js and vscode-js-debug with specific versions and latest commit.
Any help will be much appreciated