feat(neovim): adjustment to c# ftplugin

- Remove from polish.lua the dap calls that configure c#
- Set DOTNET_ENVIRONMENT variable to "Development"
- Load projects on dap continue
This commit is contained in:
Alexandre Cavalheiro S. Tiago da Silva 2025-02-17 00:58:03 -03:00
parent d00e978fd4
commit 4044df17c2
Signed by: wizardlink
GPG key ID: A5767B54367CFBDF
2 changed files with 27 additions and 40 deletions

View file

@ -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

View file

@ -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",