summaryrefslogtreecommitdiffstatshomepage
path: root/nvim_WIP/lua/config/dap.lua
diff options
context:
space:
mode:
Diffstat (limited to 'nvim_WIP/lua/config/dap.lua')
-rw-r--r--nvim_WIP/lua/config/dap.lua92
1 files changed, 92 insertions, 0 deletions
diff --git a/nvim_WIP/lua/config/dap.lua b/nvim_WIP/lua/config/dap.lua
new file mode 100644
index 0000000..0988239
--- /dev/null
+++ b/nvim_WIP/lua/config/dap.lua
@@ -0,0 +1,92 @@
+
+local dap = require("dap");
+
+dap.configurations.typescriptreact = { -- change to typescript if needed
+ {
+ type = "chrome",
+ request = "attach",
+ program = "${file}",
+ cwd = vim.fn.getcwd(),
+ sourceMaps = true,
+ protocol = "inspector",
+ port = 9222,
+ webRoot = "${workspaceFolder}"
+ }
+}
+
+require('dap.ext.vscode').load_launchjs()
+
+-- Debugpy
+dap.adapters.python = {
+ type = 'executable',
+ command = 'python',
+ args = { '-m', 'debugpy.adapter' },
+}
+
+dap.configurations.python = {
+ {
+ type = 'python',
+ request = 'launch',
+ name = 'Launch file',
+ program = '${file}',
+ pythonPath = function()
+ local venv_path = vim.fn.getenv 'VIRTUAL_ENVIRONMENT'
+ if venv_path ~= vim.NIL and venv_path ~= '' then
+ return venv_path .. '/bin/python'
+ else
+ return '/usr/bin/python'
+ end
+ end,
+ },
+}
+
+-- Neovim Lua
+dap.adapters.nlua = function(callback, config)
+ callback { type = 'server', host = config.host, port = config.port }
+end
+
+dap.configurations.lua = {
+ {
+ type = 'nlua',
+ request = 'attach',
+ name = 'Attach to running Neovim instance',
+ host = function()
+ local value = vim.fn.input 'Host [127.0.0.1]: '
+ if value ~= '' then
+ return value
+ end
+ return '127.0.0.1'
+ end,
+ port = function()
+ local val = tonumber(vim.fn.input 'Port: ')
+ assert(val, 'Please provide a port number')
+ return val
+ end,
+ },
+}
+
+-- lldb
+dap.adapters.lldb = {
+ type = 'executable',
+ command = '/usr/bin/lldb-vscode',
+ name = 'lldb',
+}
+
+dap.configurations.cpp = {
+ {
+ name = 'Launch',
+ type = 'lldb',
+ request = 'launch',
+ program = function()
+ return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
+ end,
+ cwd = '${workspaceFolder}',
+ stopOnEntry = false,
+ args = {},
+ runInTerminal = false,
+ },
+}
+
+dap.configurations.c = dap.configurations.cpp
+dap.configurations.rust = dap.configurations.cpp
+