mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-08-28 05:54:23 +02:00
fix(typescript): support more dap adapters
Make sure that pwa-node, pwa-chrome, pwa-msedge, node, chrome and msedge are supported out of the box
This commit is contained in:
parent
c5b49b52cf
commit
12d8fa9702
1 changed files with 27 additions and 24 deletions
|
@ -203,31 +203,34 @@ return {
|
|||
},
|
||||
opts = function()
|
||||
local dap = require("dap")
|
||||
if not dap.adapters["pwa-node"] then
|
||||
require("dap").adapters["pwa-node"] = {
|
||||
type = "server",
|
||||
host = "localhost",
|
||||
port = "${port}",
|
||||
executable = {
|
||||
command = "node",
|
||||
-- 💀 Make sure to update this path to point to your installation
|
||||
args = {
|
||||
LazyVim.get_pkg_path("js-debug-adapter", "/js-debug/src/dapDebugServer.js"),
|
||||
"${port}",
|
||||
|
||||
for _, adapterType in ipairs({ "node", "chrome", "msedge" }) do
|
||||
local pwaType = "pwa-" .. adapterType
|
||||
|
||||
if not dap.adapters[pwaType] then
|
||||
dap.adapters[pwaType] = {
|
||||
type = "server",
|
||||
host = "localhost",
|
||||
port = "${port}",
|
||||
executable = {
|
||||
command = "js-debug-adapter",
|
||||
args = { "${port}" },
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
if not dap.adapters["node"] then
|
||||
dap.adapters["node"] = function(cb, config)
|
||||
if config.type == "node" then
|
||||
config.type = "pwa-node"
|
||||
end
|
||||
local nativeAdapter = dap.adapters["pwa-node"]
|
||||
if type(nativeAdapter) == "function" then
|
||||
nativeAdapter(cb, config)
|
||||
else
|
||||
cb(nativeAdapter)
|
||||
}
|
||||
end
|
||||
|
||||
-- Define adapters without the "pwa-" prefix for VSCode compatibility
|
||||
if not dap.adapters[adapterType] then
|
||||
dap.adapters[adapterType] = function(cb, config)
|
||||
local nativeAdapter = dap.adapters[pwaType]
|
||||
|
||||
config.type = pwaType
|
||||
|
||||
if type(nativeAdapter) == "function" then
|
||||
nativeAdapter(cb, config)
|
||||
else
|
||||
cb(nativeAdapter)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue