user_example
user_example copied to clipboard
how to setup dap config from user config files
I am trying to setup the debugger from react and am successful in doing so, only if I add my config file somewhere inside the Astrovim folder and calling require for this config file
Eg added my config nvim-dap-config.lua inside astrovim/plugins/configs/nvim-dap-config.lua and called
local dap-config = require("plugins.configs.nvim-dap-config") inside mappings.lua .Everything is working as expected
now I wanted to move this file to $HOME/config/astrovim/user/... Can i get some help on how to acheive this
Contents of nvim-dap-config.lua
local dap = require("dap")
dap.set_log_level("TRACE")
dap.adapters.node2 = {
type = "executable",
command = "node",
args = { vim.fn.stdpath("data") .. "/mason/packages/node-debug2-adapter/out/src/nodeDebug.js" },
}
dap.configurations.javascriptreact = {
{
name = "Chrome (9222)",
type = "chrome",
request = "attach",
program = "${file}",
cwd = vim.fn.getcwd(),
sourceMaps = true,
protocol = "inspector",
port = 9222,
webRoot = "${workspaceFolder}",
},
{
name = "React Native (8081) (Node2)",
type = "node2",
request = "attach",
program = "${file}",
cwd = vim.fn.getcwd(),
sourceMaps = true,
protocol = "inspector",
console = "integratedTerminal",
port = 8081,
},
{
name = "Attach React Native (8081)",
type = "pwa-node",
request = "attach",
processId = require("dap.utils").pick_process,
cwd = vim.fn.getcwd(),
rootPath = "${workspaceFolder}",
skipFiles = { "<node_internals>/**", "node_modules/**" },
sourceMaps = true,
protocol = "inspector",
console = "integratedTerminal",
},
}
I tried following the same method as above, the file is getting detected by the astro config, but dap this new dap config is not getting appended
Any help on how to add this config in my user astro config will be much appreciated
I don't want to lose new features