feat(nvim): improved dap integration
This commit is contained in:
parent
2e7cc78aa0
commit
8fa347dcf9
@ -54,13 +54,56 @@ dap.configurations.cpp = {
|
|||||||
dap.configurations.c = dap.configurations.cpp
|
dap.configurations.c = dap.configurations.cpp
|
||||||
dap.configurations.rust = dap.configurations.cpp
|
dap.configurations.rust = dap.configurations.cpp
|
||||||
|
|
||||||
dap.configurations.cs = {
|
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",
|
type = "coreclr",
|
||||||
name = "launch - netcoredbg",
|
name = "launch - netcoredbg",
|
||||||
request = "launch",
|
request = "launch",
|
||||||
program = function()
|
program = function()
|
||||||
return vim.fn.input("Path to dll: ", vim.fn.getcwd() .. "/bin/Debug/", "file")
|
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,
|
end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dap.configurations.cs = config
|
||||||
|
dap.configurations.fsharp = config
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
local dap_python = require('dap-python')
|
local dap_python = require("dap-python")
|
||||||
dap_python.setup('~/.venvs/debugpy/bin/python')
|
dap_python.setup(vim.fn.stdpath("data") .. "/mason/packages/debugpy/venv/bin/python3")
|
||||||
dap_python.test_runner = 'pytest'
|
dap_python.test_runner = "pytest"
|
||||||
|
Loading…
Reference in New Issue
Block a user