From: Ruben Beltran del Rio Date: Tue, 20 Feb 2024 16:13:01 +0000 (+0100) Subject: Configure DAP for JS X-Git-Url: https://git.r.bdr.sh/rbdr/dotfiles/commitdiff_plain/a51791d1487a9673b3749135456f39d5e5b724ca Configure DAP for JS --- diff --git a/config/nvim/lua/dap_config.lua b/config/nvim/lua/dap_config.lua index 2131958..b84af74 100644 --- a/config/nvim/lua/dap_config.lua +++ b/config/nvim/lua/dap_config.lua @@ -5,29 +5,26 @@ vim.keymap.set('n', 'd', function() require("dapui").toggle() end) -dap.adapters.node2 = { - type = 'executable', - command = 'node', - args = {os.getenv('HOME') .. '/projects/tools/vscode-node-debug2/out/src/nodeDebug.js'}, -} +require("dap-vscode-js").setup({ + debugger_path = os.getenv('HOME') .. '/projects/tools/vscode-js-debug/out/adapter.bundle.js', + adapters = { 'pwa-node', 'node-terminal' }, +}) + dap.configurations.javascript = { { - name = 'Launch', - type = 'node2', - request = 'launch', - program = '${file}', - cwd = vim.fn.getcwd(), - sourceMaps = true, - protocol = 'inspector', - console = 'integratedTerminal', + type = "pwa-node", + request = "launch", + name = "Launch file", + program = "${file}", + cwd = "${workspaceFolder}", }, { - -- For this to work you need to make sure the node process is started with the `--inspect` flag. - name = 'Attach to process', - type = 'node2', - request = 'attach', + type = "pwa-node", + request = "attach", + name = "Attach", processId = require'dap.utils'.pick_process, - }, + cwd = "${workspaceFolder}", + } } dap.adapters.firefox = { @@ -37,14 +34,14 @@ dap.adapters.firefox = { } dap.configurations.typescript = { - { - name = 'Debug with Firefox', - type = 'firefox', - request = 'launch', - reAttach = true, - url = 'http://localhost:3000', - webRoot = '${workspaceFolder}', - firefoxExecutable = '/Applications/Firefox Developer Edition.app/Contents/MacOS/firefox' + { + name = 'Debug with Firefox', + type = 'firefox', + request = 'launch', + reAttach = true, + url = 'http://localhost:3000', + webRoot = '${workspaceFolder}', + firefoxExecutable = '/Applications/Firefox Developer Edition.app/Contents/MacOS/firefox' } } @@ -115,4 +112,3 @@ dap.configurations.python = { require('neodev').setup({ library = { plugins = { "nvim-dap-ui" }, types = true } }) - diff --git a/config/nvim/lua/plugins.lua b/config/nvim/lua/plugins.lua index 17f2fb4..24154d9 100644 --- a/config/nvim/lua/plugins.lua +++ b/config/nvim/lua/plugins.lua @@ -50,6 +50,7 @@ require('lazy').setup({ -- Debugging 'mfussenegger/nvim-dap', 'rcarriga/nvim-dap-ui', + 'mxsdev/nvim-dap-vscode-js', -- Editing 'ms-jpq/coq_nvim',