mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-08-28 22:08:19 +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,27 +203,29 @@ return {
|
|||
},
|
||||
opts = function()
|
||||
local dap = require("dap")
|
||||
if not dap.adapters["pwa-node"] then
|
||||
require("dap").adapters["pwa-node"] = {
|
||||
|
||||
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 = "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}",
|
||||
},
|
||||
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"]
|
||||
|
||||
-- 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
|
||||
|
@ -231,6 +233,7 @@ return {
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local js_filetypes = { "typescript", "javascript", "typescriptreact", "javascriptreact" }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue