feat(neovim): set up dap for rust & .NET

This commit is contained in:
Felix Schröter 2022-07-30 08:38:47 +02:00
parent 2cfdfb07bc
commit 08afb639f6
Signed by: felschr
GPG key ID: 671E39E6744C807D
2 changed files with 45 additions and 4 deletions

View file

@ -1,9 +1,18 @@
{ config, pkgs, ... }:
{ config, pkgs, lib, ... }:
{
let vscodeExtensions = with pkgs; [ vscode-extensions.ms-vscode.cpptools ];
in {
home.packages = with pkgs; [
netcoredbg
# vscode-firefox-debug # TODO not packaged
haskellPackages.haskell-dap
];
home.file = builtins.listToAttrs (map (x: {
name = ".vscode/extensions/${x.vscodeExtUniqueId}";
value = {
source = "${x}/share/vscode/extensions/${x.vscodeExtUniqueId}";
recursive = true;
};
}) vscodeExtensions);
}

View file

@ -2,6 +2,12 @@ local dap = require("dap")
local function pwd() return io.popen("pwd"):lines()() end
dap.adapters.cppdbg = {
id = "cppdbg",
type = "executable",
command = os.getenv("HOME") .. "/.vscode/extensions/ms-vscode.cpptools/debugAdapters/bin/OpenDebugAD7",
}
dap.adapters.netcoredbg = {
type = "executable",
command = "netcoredbg",
@ -12,14 +18,40 @@ dap.adapters.netcoredbg = {
},
}
dap.configurations.cpp = {
{
name = "Launch file",
type = "cppdbg",
request = "launch",
program = function()
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
end,
cwd = "${workspaceFolder}",
stopOnEntry = true,
},
{
name = "Attach to gdbserver :1234",
type = "cppdbg",
request = "launch",
MIMode = "gdb",
miDebuggerServerAddress = "localhost:1234",
miDebuggerPath = "/usr/bin/gdb",
cwd = "${workspaceFolder}",
program = function()
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
end,
},
}
dap.configurations.c = dap.configurations.cpp
dap.configurations.rust = dap.configurations.cpp
dap.configurations.cs = {
{
type = "netcoredbg",
name = "launch - netcoredbg",
request = "launch",
program = function()
local dll = io.popen("find bin/Debug/ -maxdepth 2 -name \"*.dll\"")
return pwd() .. "/" .. dll:lines()()
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
end,
stopAtEntry = true,
},