This commit is contained in:
Alexey Svirshchevskiy 2025-08-09 13:33:35 +00:00 committed by GitHub
commit 424ac6ece8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 35 additions and 35 deletions

View file

@ -67,13 +67,6 @@ return {
{ text = sign[1], texthl = sign[2] or "DiagnosticInfo", linehl = sign[3], numhl = sign[3] } { text = sign[1], texthl = sign[2] or "DiagnosticInfo", linehl = sign[3], numhl = sign[3] }
) )
end end
-- setup dap config by VsCode launch.json file
local vscode = require("dap.ext.vscode")
local json = require("plenary.json")
vscode.json_decode = function(str)
return vim.json.decode(json.json_strip_comments(str))
end
end, end,
}, },

View file

@ -203,27 +203,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
@ -231,13 +233,10 @@ return {
end end
end end
end end
end
local js_filetypes = { "typescript", "javascript", "typescriptreact", "javascriptreact" } local js_filetypes = { "typescript", "javascript", "typescriptreact", "javascriptreact" }
local vscode = require("dap.ext.vscode")
vscode.type_to_filetypes["node"] = js_filetypes
vscode.type_to_filetypes["pwa-node"] = js_filetypes
for _, language in ipairs(js_filetypes) do for _, language in ipairs(js_filetypes) do
if not dap.configurations[language] then if not dap.configurations[language] then
dap.configurations[language] = { dap.configurations[language] = {
@ -261,6 +260,14 @@ return {
end, end,
}, },
{
"jay-babu/mason-nvim-dap.nvim",
optional = true,
opts = {
automatic_installation = { exclude = { "chrome" } },
},
},
-- Filetype icons -- Filetype icons
{ {
"echasnovski/mini.icons", "echasnovski/mini.icons",