From c0d8272dc12c364f0e7a6b93752663a4ed125faa Mon Sep 17 00:00:00 2001 From: Alexey Svirshchevskiy Date: Sat, 9 Aug 2025 14:20:36 +0200 Subject: [PATCH 1/3] fix(dap): remove unnecessary dap.ext.vscode --- lua/lazyvim/plugins/extras/dap/core.lua | 7 ------- lua/lazyvim/plugins/extras/lang/typescript.lua | 4 ---- 2 files changed, 11 deletions(-) diff --git a/lua/lazyvim/plugins/extras/dap/core.lua b/lua/lazyvim/plugins/extras/dap/core.lua index d84b71bf..3a69a2c5 100644 --- a/lua/lazyvim/plugins/extras/dap/core.lua +++ b/lua/lazyvim/plugins/extras/dap/core.lua @@ -67,13 +67,6 @@ return { { text = sign[1], texthl = sign[2] or "DiagnosticInfo", linehl = sign[3], numhl = sign[3] } ) 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, }, diff --git a/lua/lazyvim/plugins/extras/lang/typescript.lua b/lua/lazyvim/plugins/extras/lang/typescript.lua index f7cc3231..1c5db47a 100644 --- a/lua/lazyvim/plugins/extras/lang/typescript.lua +++ b/lua/lazyvim/plugins/extras/lang/typescript.lua @@ -234,10 +234,6 @@ return { 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 if not dap.configurations[language] then dap.configurations[language] = { From c5b49b52cffb13b6bcc10029c8b4a5161da851e9 Mon Sep 17 00:00:00 2001 From: Alexey Svirshchevskiy Date: Sat, 9 Aug 2025 14:21:20 +0200 Subject: [PATCH 2/3] fix(dap): don't install deprecated chrome debugger --- lua/lazyvim/plugins/extras/lang/typescript.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lua/lazyvim/plugins/extras/lang/typescript.lua b/lua/lazyvim/plugins/extras/lang/typescript.lua index 1c5db47a..1aa5604d 100644 --- a/lua/lazyvim/plugins/extras/lang/typescript.lua +++ b/lua/lazyvim/plugins/extras/lang/typescript.lua @@ -257,6 +257,14 @@ return { end, }, + { + "jay-babu/mason-nvim-dap.nvim", + optional = true, + opts = { + automatic_installation = { exclude = { "chrome" } }, + }, + }, + -- Filetype icons { "echasnovski/mini.icons", From 12d8fa9702da3e3ecb9fc86c6e0745ef4dddbf97 Mon Sep 17 00:00:00 2001 From: Alexey Svirshchevskiy Date: Sat, 9 Aug 2025 14:23:18 +0200 Subject: [PATCH 3/3] 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 --- .../plugins/extras/lang/typescript.lua | 51 ++++++++++--------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/typescript.lua b/lua/lazyvim/plugins/extras/lang/typescript.lua index 1aa5604d..f9ffda04 100644 --- a/lua/lazyvim/plugins/extras/lang/typescript.lua +++ b/lua/lazyvim/plugins/extras/lang/typescript.lua @@ -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