feat(typescript): add "node" debug adapter

add "node" debug adapter for compatibility with .vscode/launch.json
This commit is contained in:
Avinash Thakur 2024-05-01 20:51:13 +05:30
parent bb36f71b77
commit 41eae677c5
No known key found for this signature in database
GPG key ID: 4877E61DE468FD05

View file

@ -1,3 +1,7 @@
local debugtypePreferred = {
['node'] = 'pwa-node',
}
return {
-- add typescript to treesitter
@ -87,6 +91,18 @@ return {
},
}
end
if not dap.adapters['node'] then
dap.adapters['node'] = function (cb, config)
config.type = debugtypePreferred[config.type] or config.type
local nativeAdapter = dap.adapters['pwa-node']
if type(nativeAdapter) == 'function' then
nativeAdapter(cb, config )
else
cb(nativeAdapter)
end
end
end
for _, language in ipairs({ "typescript", "javascript", "typescriptreact", "javascriptreact" }) do
if not dap.configurations[language] then
dap.configurations[language] = {