1 local dap = require('dap')
2 require("dapui").setup()
4 vim.keymap.set('n', '<leader>d', function()
5 require("dapui").toggle()
11 args = {os.getenv('HOME') .. '/projects/tools/vscode-node-debug2/out/src/nodeDebug.js'},
13 dap.configurations.javascript = {
19 cwd = vim.fn.getcwd(),
21 protocol = 'inspector',
22 console = 'integratedTerminal',
25 -- For this to work you need to make sure the node process is started with the `--inspect` flag.
26 name = 'Attach to process',
29 processId = require'dap.utils'.pick_process,
33 dap.adapters.firefox = {
36 args = {os.getenv('HOME') .. '/projects/tools/vscode-firefox-debug/dist/adapter.bundle.js'},
39 dap.configurations.typescript = {
41 name = 'Debug with Firefox',
45 url = 'http://localhost:3000',
46 webRoot = '${workspaceFolder}',
47 firefoxExecutable = '/Applications/Firefox Developer Edition.app/Contents/MacOS/firefox'
51 dap.configurations.typescriptreact = {
53 name = 'Debug with Firefox',
57 url = 'http://localhost:3000',
58 webRoot = '${workspaceFolder}',
59 firefoxExecutable = '/Applications/Firefox Developer Edition.app/Contents/MacOS/firefox'
63 dap.adapters.python = function(cb, config)
64 if config.request == 'attach' then
65 ---@diagnostic disable-next-line: undefined-field
66 local port = (config.connect or config).port
67 ---@diagnostic disable-next-line: undefined-field
68 local host = (config.connect or config).host or '127.0.0.1'
71 port = assert(port, '`connect.port` is required for a python `attach` configuration'),
74 source_filetype = 'python',
80 command = os.getenv('HOME') .. '/.asdf/shims/python',
81 args = { '-m', 'debugpy.adapter' },
83 source_filetype = 'python',
89 dap.configurations.python = {
91 -- The first three options are required by nvim-dap
92 type = 'python'; -- the type here established the link to the adapter definition: `dap.adapters.python`
96 -- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options
98 program = "${file}"; -- This configuration will launch the current file if used.
99 pythonPath = function()
100 -- debugpy supports launching an application with a different interpreter then the one used to launch debugpy itself.
101 -- The code below looks for a `venv` or `.venv` folder in the current directly and uses the python within.
102 -- You could adapt this - to for example use the `VIRTUAL_ENV` environment variable.
103 local cwd = vim.fn.getcwd()
104 if vim.fn.executable(cwd .. '/venv/bin/python') == 1 then
105 return cwd .. '/venv/bin/python'
106 elseif vim.fn.executable(cwd .. '/.venv/bin/python') == 1 then
107 return cwd .. '/.venv/bin/python'
109 return os.getenv('HOME') .. '/.asdf/shims/python'
115 require('neodev').setup({
116 library = { plugins = { "nvim-dap-ui" }, types = true }