mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-12-25 12:14:19 +01:00
fix(typescript): support chrome, node and msedge dap adapters (#6649)
## Description Add support for `chrome`, `node` and `msedge` configs for dap typescript. ## Related Issue(s) https://github.com/LazyVim/LazyVim/pull/6328 ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines.
This commit is contained in:
committed by
GitHub
parent
faeb24ba95
commit
0b65d33d85
@@ -226,31 +226,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
|
||||
@@ -308,6 +311,15 @@ return {
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"jay-babu/mason-nvim-dap.nvim",
|
||||
optional = true,
|
||||
opts = {
|
||||
-- chrome adapter is deprecated, use js-debug-adapter instead
|
||||
automatic_installation = { exclude = { "chrome" } },
|
||||
},
|
||||
},
|
||||
|
||||
-- Filetype icons
|
||||
{
|
||||
"nvim-mini/mini.icons",
|
||||
|
||||
Reference in New Issue
Block a user