diff --git a/modules/home-manager/programs/neovim/ftplugin/cs.lua b/modules/home-manager/programs/neovim/ftplugin/cs.lua index 3b69f26..c129918 100644 --- a/modules/home-manager/programs/neovim/ftplugin/cs.lua +++ b/modules/home-manager/programs/neovim/ftplugin/cs.lua @@ -83,6 +83,10 @@ end ---@return thread function M:choose_dll() + self.projects = self.find_projects() + + local dap = require "dap" + return coroutine.create(function(search_coroutine) vim.ui.select( self.projects, @@ -96,9 +100,13 @@ function M:choose_dll() }, ---@param item CSFTPlugin.Project function(item) - self:run "build" + local path = item and item.dll_path or dap.ABORT - coroutine.resume(search_coroutine, item and item.dll_path or require("dap").ABORT) + if path ~= dap.ABORT then + self:run "build" + end + + coroutine.resume(search_coroutine, path) end ) end) @@ -112,10 +120,20 @@ function M:start() return end - self.projects = self.find_projects() + vim.fn.setenv("DOTNET_ENVIRONMENT", "Development") + + local debugger_path = vim.fn.getnixpath "netcoredbg" .. "/bin/netcoredbg" local dap = require "dap" + ---@type dap.ExecutableAdapter + dap.adapters.netcoredbg = { + type = "executable", + command = debugger_path, + args = { "--interpreter=vscode" }, + } + + ---@type dap.Configuration[] dap.configurations.cs = { { type = "netcoredbg", @@ -127,8 +145,6 @@ function M:start() }, } - vim.notify_once("Loaded projects for nvim-dap", vim.log.levels.INFO) - vim.g.loaded_csftplugin = true end diff --git a/modules/home-manager/programs/neovim/polish.lua b/modules/home-manager/programs/neovim/polish.lua index c0c62c4..7f2c3d1 100644 --- a/modules/home-manager/programs/neovim/polish.lua +++ b/modules/home-manager/programs/neovim/polish.lua @@ -83,7 +83,7 @@ end, { range = true, nargs = "?" }) local dap = require "dap" --- @type DapAdapter +---@type dap.Adapter dap.adapters.codelldb = { port = "${port}", type = "server", @@ -93,7 +93,7 @@ dap.adapters.codelldb = { }, } --- @type DapAdapter +---@type dap.Adapter dap.adapters.cppdbg = { id = "cppdbg", type = "executable", @@ -101,21 +101,14 @@ dap.adapters.cppdbg = { "{pkgs.vscode-extensions.ms-vscode.cpptools}/share/vscode/extensions/ms-vscode.cpptools/debugAdapters/bin/OpenDebugAD7", } --- @type DapAdapter -dap.adapters.netcoredbg = { - type = "executable", - command = "netcoredbg", - args = { "--interpreter=vscode" }, -} - --- @type DapAdapter +---@type dap.Adapter dap.adapters.godot = { type = "server", host = "127.0.0.1", port = 6006, } --- @type DapConfiguration +---@type dap.Configuration[] dap.configurations.rust = { { name = "Launch file", @@ -129,7 +122,7 @@ dap.configurations.rust = { }, } --- @type DapConfiguration +---@type dap.Configuration[] dap.configurations.cpp = { { name = "Launch file", @@ -157,29 +150,7 @@ dap.configurations.cpp = { dap.configurations.c = dap.configurations.cpp --- @type DapConfiguration -dap.configurations.cs = { - { - type = "netcoredbg", - name = "Launch DLL", - request = "launch", - program = function() - return vim.fn.input("Path to dll", vim.fn.getcwd() .. "/bin/Debug/", "file") - end, - }, - { - type = "netcoredbg", - name = "Attach to debugger", - request = "attach", - program = function() - return vim.fn.input("Path to dll", vim.fn.getcwd() .. "/bin/Debug/", "file") - end, - pid = "${command:pickProcess}", - cwd = "${workspaceFolder}", - }, -} - --- @type DapConfiguration +---@type dap.Configuration[] dap.configurations.gdscript = { { name = "Launch scene",