1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
local dap = require('dap')
require("dapui").setup()
vim.keymap.set('n', '<leader>d', function()
require("dapui").toggle()
end)
require("dap-vscode-js").setup({
debugger_path = os.getenv('HOME') .. '/projects/vendor/vscode-js-debug/out/adapter.bundle.js',
adapters = { 'pwa-node', 'node-terminal' },
})
require("dap").adapters["pwa-node"] = {
type = 'server',
host = 'localhost',
port = '${port}',
executable = {
command = 'node',
-- 💀 Make sure to update this path to point to your installation
args = { os.getenv('HOME') .. '/projects/vendor/vscode-js-debug/src/dapDebugServer.ts', '${port}' },
}
}
dap.configurations.javascript = {
{
type = "pwa-node",
request = "attach",
name = "Attach",
cwd = "${workspaceFolder}",
},
{
type = "pwa-node",
request = "launch",
name = "Launch file",
program = "${file}",
cwd = "${workspaceFolder}",
},
}
dap.adapters.firefox = {
type = 'executable',
command = 'node',
args = {os.getenv('HOME') .. '/projects/tools/vscode-firefox-debug/dist/adapter.bundle.js'},
}
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'
}
}
dap.configurations.typescriptreact = {
{
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'
}
}
dap.adapters.python = function(cb, config)
if config.request == 'attach' then
---@diagnostic disable-next-line: undefined-field
local port = (config.connect or config).port
---@diagnostic disable-next-line: undefined-field
local host = (config.connect or config).host or '127.0.0.1'
cb({
type = 'server',
port = assert(port, '`connect.port` is required for a python `attach` configuration'),
host = host,
options = {
source_filetype = 'python',
},
})
else
cb({
type = 'executable',
command = os.getenv('HOME') .. '/.asdf/shims/python',
args = { '-m', 'debugpy.adapter' },
options = {
source_filetype = 'python',
},
})
end
end
dap.configurations.python = {
{
-- The first three options are required by nvim-dap
type = 'python'; -- the type here established the link to the adapter definition: `dap.adapters.python`
request = 'launch';
name = "Launch file";
-- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options
program = "${file}"; -- This configuration will launch the current file if used.
pythonPath = function()
-- debugpy supports launching an application with a different interpreter then the one used to launch debugpy itself.
-- The code below looks for a `venv` or `.venv` folder in the current directly and uses the python within.
-- You could adapt this - to for example use the `VIRTUAL_ENV` environment variable.
local cwd = vim.fn.getcwd()
if vim.fn.executable(cwd .. '/venv/bin/python') == 1 then
return cwd .. '/venv/bin/python'
elseif vim.fn.executable(cwd .. '/.venv/bin/python') == 1 then
return cwd .. '/.venv/bin/python'
else
return os.getenv('HOME') .. '/.asdf/shims/python'
end
end;
},
}
|