diff options
| author | adalessa <dalessandro.ariel@gmail.com> | 2023-03-04 16:14:13 +0100 |
|---|---|---|
| committer | adalessa <dalessandro.ariel@gmail.com> | 2023-03-04 16:14:13 +0100 |
| commit | 8fc48402953a9d91e5c05662c7fa6dfae8605fc9 (patch) | |
| tree | 76e266425d780f7b93e7e40bbf1cf9485c3700cc /lua/alpha/dap/configs/javascript.lua | |
| parent | 61499082db8f34ca38fc9eb916f9cc87d82e7655 (diff) | |
| download | nvim-conf-8fc48402953a9d91e5c05662c7fa6dfae8605fc9.tar.gz nvim-conf-8fc48402953a9d91e5c05662c7fa6dfae8605fc9.zip | |
feat: improve dap
Diffstat (limited to 'lua/alpha/dap/configs/javascript.lua')
| -rw-r--r-- | lua/alpha/dap/configs/javascript.lua | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/lua/alpha/dap/configs/javascript.lua b/lua/alpha/dap/configs/javascript.lua new file mode 100644 index 0000000..b910f30 --- /dev/null +++ b/lua/alpha/dap/configs/javascript.lua @@ -0,0 +1,45 @@ +require("dap-vscode-js").setup { + debugger_cmd = { "js-debug-adapter" }, + adapters = { "pwa-node", "pwa-chrome", "node-terminal" }, +} + +for _, language in ipairs { "typescript", "javascript" } do + require("dap").configurations[language] = { + { + type = "pwa-node", + request = "launch", + name = "Launch file", + program = "${file}", + cwd = "${workspaceFolder}", + }, + { + type = "pwa-node", + request = "attach", + name = "Attach", + processId = require("dap.utils").pick_process, + cwd = "${workspaceFolder}", + }, + } +end + +for _, language in ipairs { "typescriptreact", "javascriptreact" } do + require("dap").configurations[language] = { + { + type = "pwa-chrome", + name = "Attach - Remote Debugging", + request = "attach", + program = "${file}", + cwd = vim.fn.getcwd(), + sourceMaps = true, + protocol = "inspector", + port = 9222, + webRoot = "${workspaceFolder}", + }, + { + type = "pwa-chrome", + name = "Launch Chrome", + request = "launch", + url = "http://localhost:3000", + }, + } +end |