111 lines
2.6 KiB
Lua
111 lines
2.6 KiB
Lua
return {
|
|
{ -- nvim-dap
|
|
'mfussenegger/nvim-dap',
|
|
|
|
config = function(_, _)
|
|
local dap = require('dap')
|
|
|
|
dap.adapters.coreclr = {
|
|
type = 'executable',
|
|
command = vim.fn.exepath('netcoredbg'),
|
|
args = { '--interpreter=vscode' },
|
|
}
|
|
|
|
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
|
|
|
|
local config = {
|
|
{
|
|
type = 'coreclr',
|
|
name = 'launch - netcoredbg',
|
|
request = 'launch',
|
|
program = function()
|
|
return coroutine.create(function(dap_prg_crt)
|
|
if vim.fn.confirm('Should I recompile first?', '&yes\n&no', 2) == 1 then
|
|
vim.g.dotnet_build_project()
|
|
end
|
|
local dll = vim.g.dotnet_get_dll_path()
|
|
coroutine.resume(dap_prg_crt, dll)
|
|
end)
|
|
end,
|
|
args = function()
|
|
return coroutine.create(function(dap_arg_crt)
|
|
vim.ui.input({ prompt = 'Args >' }, function(choice)
|
|
choice = choice or nil
|
|
local arg = vim.split(choice, ' ')
|
|
coroutine.resume(dap_arg_crt, arg)
|
|
end)
|
|
end)
|
|
end,
|
|
},
|
|
}
|
|
|
|
dap.configurations.cs = config
|
|
dap.configurations.fsharp = config
|
|
end,
|
|
},
|
|
{ -- nvim-dap-virtual-text
|
|
'theHamsta/nvim-dap-virtual-text',
|
|
dependencies = {
|
|
'mfussenegger/nvim-dap',
|
|
'nvim-treesitter/nvim-treesitter',
|
|
},
|
|
},
|
|
{ -- nvim-dap-ui
|
|
'rcarriga/nvim-dap-ui',
|
|
dependencies = {
|
|
'mfussenegger/nvim-dap',
|
|
'theHamsta/nvim-dap-virtual-text',
|
|
'nvim-neotest/nvim-nio',
|
|
},
|
|
opts = {},
|
|
keys = {
|
|
{
|
|
'<leader>dt',
|
|
function()
|
|
require('dapui').toggle()
|
|
end,
|
|
desc = 'open dapui',
|
|
},
|
|
},
|
|
},
|
|
}
|