forked from ayamir/nvimdots
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
394 additions
and
537 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
-- https://github.com/mfussenegger/nvim-dap/wiki/C-C---Rust-(via--codelldb) | ||
return function() | ||
local dap = require("dap") | ||
local utils = require("modules.utils.dap") | ||
local is_windows = require("core.global").is_windows | ||
|
||
dap.adapters.codelldb = { | ||
type = "server", | ||
port = "${port}", | ||
executable = { | ||
command = vim.fn.exepath("codelldb"), -- Find codelldb on $PATH | ||
args = { "--port", "${port}" }, | ||
detached = is_windows and false or true, | ||
}, | ||
} | ||
dap.configurations.c = { | ||
{ | ||
name = "Launch the debugger", | ||
type = "codelldb", | ||
request = "launch", | ||
program = utils.input_exec_path(), | ||
args = utils.input_args(), | ||
cwd = "${workspaceFolder}", | ||
stopOnEntry = false, | ||
}, | ||
} | ||
dap.configurations.cpp = dap.configurations.c | ||
dap.configurations.rust = dap.configurations.c | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
-- https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation#go-using-delve-directly | ||
-- https://github.com/go-delve/delve/blob/master/Documentation/usage/dlv_dap.md | ||
return function() | ||
local dap = require("dap") | ||
local utils = require("modules.utils.dap") | ||
|
||
dap.adapters.go = function(callback) | ||
local stdout = vim.loop.new_pipe(false) | ||
local handle | ||
local pid_or_err | ||
local port = 28695 | ||
local opts = { | ||
stdio = { nil, stdout }, | ||
args = { "dap", "-l", "127.0.0.1:" .. port }, | ||
detached = true, | ||
} | ||
handle, pid_or_err = vim.loop.spawn(vim.fn.exepath("dlv"), opts, function(code) | ||
stdout:close() | ||
handle:close() | ||
if code ~= 0 then | ||
vim.notify( | ||
string.format('"dlv" exited with code: %d, please check your configs for correctness.', code), | ||
vim.log.levels.WARN, | ||
{ title = "[go] DAP Warning!" } | ||
) | ||
end | ||
end) | ||
assert(handle, "Error running dlv: " .. tostring(pid_or_err)) | ||
stdout:read_start(function(err, chunk) | ||
assert(not err, err) | ||
if chunk then | ||
vim.schedule(function() | ||
require("dap.repl").append(chunk) | ||
end) | ||
end | ||
end) | ||
-- Wait for delve to start | ||
vim.defer_fn(function() | ||
callback({ type = "server", host = "127.0.0.1", port = port }) | ||
end, 100) | ||
end | ||
dap.configurations.go = { | ||
{ type = "go", name = "Debug", request = "launch", program = "${file}" }, | ||
{ | ||
type = "go", | ||
name = "Debug with args", | ||
request = "launch", | ||
program = "${file}", | ||
args = utils.input_args(), | ||
}, | ||
{ | ||
type = "go", | ||
name = "Debug test", -- configuration for debugging test files | ||
request = "launch", | ||
mode = "test", | ||
program = "${file}", | ||
}, -- works with go.mod packages and sub packages | ||
{ | ||
type = "go", | ||
name = "Debug test (go.mod)", | ||
request = "launch", | ||
mode = "test", | ||
program = "./${relativeFileDirname}", | ||
}, | ||
} | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
-- https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation#ccrust-via-lldb-vscode | ||
return function() | ||
local dap = require("dap") | ||
local utils = require("modules.utils.dap") | ||
|
||
dap.adapters.lldb = { | ||
type = "executable", | ||
command = "lldb-vscode", | ||
name = "lldb", | ||
} | ||
dap.configurations.c = { | ||
{ | ||
name = "Launch", | ||
type = "lldb", | ||
request = "launch", | ||
program = utils.input_exec_path(), | ||
cwd = "${workspaceFolder}", | ||
args = utils.input_args(), | ||
env = utils.get_env(), | ||
|
||
-- if you change `runInTerminal` to true, you might need to change the yama/ptrace_scope setting: | ||
-- | ||
-- echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope | ||
-- | ||
-- Otherwise you might get the following error: | ||
-- | ||
-- Error on launch: Failed to attach to the target process | ||
-- | ||
-- But you should be aware of the implications: | ||
-- https://www.kernel.org/doc/html/latest/admin-guide/LSM/Yama.html | ||
runInTerminal = false, | ||
}, | ||
} | ||
|
||
dap.configurations.cpp = dap.configurations.c | ||
dap.configurations.rust = dap.configurations.c | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
-- https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation#python | ||
return function() | ||
local dap = require("dap") | ||
local debugpy = vim.fn.exepath("debugpy-adapter") | ||
|
||
local function is_empty(s) | ||
return s == nil or s == "" | ||
end | ||
|
||
dap.adapters.python = function(callback, 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" | ||
callback({ | ||
type = "server", | ||
port = assert(port, "`connect.port` is required for a python `attach` configuration"), | ||
host = host, | ||
options = { source_filetype = "python" }, | ||
}) | ||
else | ||
callback({ | ||
type = "executable", | ||
command = debugpy, | ||
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() | ||
if not is_empty(vim.env.CONDA_PREFIX) then | ||
return vim.env.CONDA_PREFIX .. "/bin/python" | ||
else | ||
return "python3" | ||
end | ||
end, | ||
}, | ||
} | ||
|
||
-- NOTE: This setting is for people using venv | ||
-- 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, venv = vim.fn.getcwd(), os.getenv("VIRTUAL_ENV") | ||
-- if venv and vim.fn.executable(venv .. "/bin/python") == 1 then | ||
-- return venv .. "/bin/python" | ||
-- elseif 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 "python3" | ||
-- end | ||
-- end, | ||
end |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.