From a07935eb5423336610a3551e75fa2d9cbd52c6d9 Mon Sep 17 00:00:00 2001 From: EsVagy42 Date: Sun, 21 Sep 2025 01:08:50 +0200 Subject: [PATCH] Added attach target to dap for c#, fixes #7 --- config/dap.nix | 78 +++++++++++++++++++++++++++----------------------- 1 file changed, 42 insertions(+), 36 deletions(-) diff --git a/config/dap.nix b/config/dap.nix index 0c26c1c..12751e7 100644 --- a/config/dap.nix +++ b/config/dap.nix @@ -3,43 +3,49 @@ dap = { enable = true; luaConfig.post = '' - local dap = require('dap') - dap.adapters.lldb = { - type = 'executable', - command = '/run/current-system/sw/bin/lldb-dap', -- adjust as needed, must be absolute path - 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 = true, - args = {}, - runInTerminal = true, - }, - } + local dap = require('dap') + dap.adapters.lldb = { + type = 'executable', + command = '/run/current-system/sw/bin/lldb-dap', -- adjust as needed, must be absolute path + 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 = true, + args = {}, + runInTerminal = true, + }, + } - dap.adapters.coreclr = { - type = 'executable', - command = '/run/current-system/sw/bin/netcoredbg', - args = {'--interpreter=vscode'}, - name = 'netcoreclr' - } - dap.configurations.cs = { - { - type = "coreclr", - name = "launch - netcoredbg", - request = "launch", - program = function() - return vim.fn.input('Path to dll ', vim.fn.getcwd() .. '/bin/Debug/', 'file') - end, - }, - } ''; + dap.adapters.coreclr = { + type = 'executable', + command = '/run/current-system/sw/bin/netcoredbg', + args = {'--interpreter=vscode'}, + name = 'netcoreclr' + } + dap.configurations.cs = { + { + type = "coreclr", + name = "launch - netcoredbg", + request = "launch", + program = function() + return vim.fn.input('Path to dll ', vim.fn.getcwd() .. '/bin/Debug/', 'file') + end, + }, + { + type = "coreclr", + name = "attach - netcoredbg", + request = "attach", + processId = require("dap.utils").pick_process, + } + } ''; }; }; }