mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-03-10 09:27:25 +00: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,27 +226,29 @@ return {
|
|||||||
},
|
},
|
||||||
opts = function()
|
opts = function()
|
||||||
local dap = require("dap")
|
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",
|
type = "server",
|
||||||
host = "localhost",
|
host = "localhost",
|
||||||
port = "${port}",
|
port = "${port}",
|
||||||
executable = {
|
executable = {
|
||||||
command = "node",
|
command = "js-debug-adapter",
|
||||||
-- 💀 Make sure to update this path to point to your installation
|
args = { "${port}" },
|
||||||
args = {
|
|
||||||
LazyVim.get_pkg_path("js-debug-adapter", "/js-debug/src/dapDebugServer.js"),
|
|
||||||
"${port}",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
if not dap.adapters["node"] then
|
|
||||||
dap.adapters["node"] = function(cb, config)
|
-- Define adapters without the "pwa-" prefix for VSCode compatibility
|
||||||
if config.type == "node" then
|
if not dap.adapters[adapterType] then
|
||||||
config.type = "pwa-node"
|
dap.adapters[adapterType] = function(cb, config)
|
||||||
end
|
local nativeAdapter = dap.adapters[pwaType]
|
||||||
local nativeAdapter = dap.adapters["pwa-node"]
|
|
||||||
|
config.type = pwaType
|
||||||
|
|
||||||
if type(nativeAdapter) == "function" then
|
if type(nativeAdapter) == "function" then
|
||||||
nativeAdapter(cb, config)
|
nativeAdapter(cb, config)
|
||||||
else
|
else
|
||||||
@@ -254,6 +256,7 @@ return {
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local js_filetypes = { "typescript", "javascript", "typescriptreact", "javascriptreact" }
|
local js_filetypes = { "typescript", "javascript", "typescriptreact", "javascriptreact" }
|
||||||
|
|
||||||
@@ -308,6 +311,15 @@ return {
|
|||||||
end,
|
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
|
-- Filetype icons
|
||||||
{
|
{
|
||||||
"nvim-mini/mini.icons",
|
"nvim-mini/mini.icons",
|
||||||
|
|||||||
Reference in New Issue
Block a user