1 local dap = require('dap')
2 require("dapui").setup()
4 vim.keymap.set('n', '<leader>d', function()
5 require("dapui").toggle()
8 require("dap-vscode-js").setup({
9 debugger_path = os.getenv('HOME') .. '/projects/tools/vscode-js-debug/out/adapter.bundle.js',
10 adapters = { 'pwa-node', 'node-terminal' },
13 dap.configurations.javascript = {
19 cwd = "${workspaceFolder}",
25 processId = require'dap.utils'.pick_process,
26 cwd = "${workspaceFolder}",
30 dap.adapters.firefox = {
33 args = {os.getenv('HOME') .. '/projects/tools/vscode-firefox-debug/dist/adapter.bundle.js'},
36 dap.configurations.typescript = {
38 name = 'Debug with Firefox',
42 url = 'http://localhost:3000',
43 webRoot = '${workspaceFolder}',
44 firefoxExecutable = '/Applications/Firefox Developer Edition.app/Contents/MacOS/firefox'
48 dap.configurations.typescriptreact = {
50 name = 'Debug with Firefox',
54 url = 'http://localhost:3000',
55 webRoot = '${workspaceFolder}',
56 firefoxExecutable = '/Applications/Firefox Developer Edition.app/Contents/MacOS/firefox'
60 dap.adapters.python = function(cb, config)
61 if config.request == 'attach' then
62 ---@diagnostic disable-next-line: undefined-field
63 local port = (config.connect or config).port
64 ---@diagnostic disable-next-line: undefined-field
65 local host = (config.connect or config).host or '127.0.0.1'
68 port = assert(port, '`connect.port` is required for a python `attach` configuration'),
71 source_filetype = 'python',
77 command = os.getenv('HOME') .. '/.asdf/shims/python',
78 args = { '-m', 'debugpy.adapter' },
80 source_filetype = 'python',
86 dap.configurations.python = {
88 -- The first three options are required by nvim-dap
89 type = 'python'; -- the type here established the link to the adapter definition: `dap.adapters.python`
93 -- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options
95 program = "${file}"; -- This configuration will launch the current file if used.
96 pythonPath = function()
97 -- debugpy supports launching an application with a different interpreter then the one used to launch debugpy itself.
98 -- The code below looks for a `venv` or `.venv` folder in the current directly and uses the python within.
99 -- You could adapt this - to for example use the `VIRTUAL_ENV` environment variable.
100 local cwd = vim.fn.getcwd()
101 if vim.fn.executable(cwd .. '/venv/bin/python') == 1 then
102 return cwd .. '/venv/bin/python'
103 elseif vim.fn.executable(cwd .. '/.venv/bin/python') == 1 then
104 return cwd .. '/.venv/bin/python'
106 return os.getenv('HOME') .. '/.asdf/shims/python'
112 require('neodev').setup({
113 library = { plugins = { "nvim-dap-ui" }, types = true }