{ pkgs, lib, ... }: { programs.nixvim = { extraPackages = with pkgs; [ netcoredbg ]; plugins.dap = { adapters = { executables = { coreclr = { command = "${lib.getExe pkgs.netcoredbg}"; args = [ "--interpreter=vscode" ]; }; }; }; configurations = let dotnet_config = { type = "coreclr"; name = "launch - netcoredbg"; request = "launch"; program.__raw = # lua '' function() if vim.fn.confirm("Should I recompile first?", "&yes\n&no", 2) == 1 then vim.g.dotnet_build_project() end return vim.g.dotnet_get_dll_path() end ''; }; in { cs = [ dotnet_config ]; fsharp = [ dotnet_config ]; }; luaConfig.pre = # lua '' vim.g.dotnet_build_project = function() local default_path = vim.fn.getcwd() .. '/' if vim.g['dotnet_last_proj_path'] ~= nil then default_path = vim.g['dotnet_last_proj_path'] end local path = vim.fn.input('Path to your *proj file', default_path, 'file') vim.g['dotnet_last_proj_path'] = path local cmd = 'dotnet build -c Debug ' .. path .. ' > /dev/null' print("") print('Cmd to execute: ' .. cmd) local f = os.execute(cmd) if f == 0 then print('\nBuild: ✔️ ') else print('\nBuild: ❌ (code: ' .. f .. ')') end end vim.g.dotnet_get_dll_path = function() local request = function() return vim.fn.input('Path to dll', vim.fn.getcwd() .. '/bin/Debug/', 'file') end if vim.g['dotnet_last_dll_path'] == nil then vim.g['dotnet_last_dll_path'] = request() else if vim.fn.confirm('Do you want to change the path to dll?\n' .. vim.g['dotnet_last_dll_path'], '&yes\n&no', 2) == 1 then vim.g['dotnet_last_dll_path'] = request() end end return vim.g['dotnet_last_dll_path'] end ''; }; }; }