added odin to overseer
This commit was merged in pull request #7.
This commit is contained in:
@@ -229,6 +229,99 @@ return {
|
||||
dap.configurations.cpp = dap.configurations.zig
|
||||
end,
|
||||
},
|
||||
|
||||
-- -------------------------------------------------------------------------
|
||||
-- Odin debugging via codelldb (same adapter as Zig/C/C++)
|
||||
-- -------------------------------------------------------------------------
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
ft = { "odin" },
|
||||
config = function()
|
||||
local dap = require("dap")
|
||||
|
||||
-- Prefer codelldb on $PATH, fall back to Mason's install location
|
||||
local codelldb = vim.fn.exepath("codelldb")
|
||||
if codelldb == "" then
|
||||
codelldb = vim.fn.stdpath("data") .. "/mason/bin/codelldb"
|
||||
end
|
||||
|
||||
dap.adapters.codelldb = {
|
||||
type = "server",
|
||||
port = "${port}",
|
||||
executable = {
|
||||
command = codelldb,
|
||||
args = { "--port", "${port}" },
|
||||
},
|
||||
}
|
||||
|
||||
local root = vim.fn.getcwd()
|
||||
|
||||
-- Detect the repo's GUI env file so the app bootstraps its config the
|
||||
-- same way `make run` does (GUI_ENV_FILE -> dotenv in config.odin).
|
||||
local env_file
|
||||
for _, candidate in ipairs({ "resources/dev/gui.env", ".env" }) do
|
||||
local p = root .. "/" .. candidate
|
||||
if vim.fn.filereadable(p) == 1 then
|
||||
env_file = p
|
||||
break
|
||||
end
|
||||
end
|
||||
local env = {}
|
||||
if env_file then
|
||||
env.GUI_ENV_FILE = env_file
|
||||
end
|
||||
|
||||
dap.configurations.odin = {
|
||||
{
|
||||
-- desi_explorer-style monorepo: `make -C gui build-debug` (-o:none
|
||||
-- -debug), then launch bin/desi_explorer with the GUI env file.
|
||||
name = "Launch (make build-debug)",
|
||||
type = "codelldb",
|
||||
request = "launch",
|
||||
program = function()
|
||||
if vim.fn.glob(root .. "/gui/Makefile") ~= "" then
|
||||
vim.fn.system({ "make", "-C", root .. "/gui", "build-debug" })
|
||||
return root .. "/bin/desi_explorer"
|
||||
end
|
||||
vim.fn.system({ "odin", "build", ".", "-o:none", "-debug", "-out:.debug_out" })
|
||||
return root .. "/.debug_out"
|
||||
end,
|
||||
cwd = root,
|
||||
stopOnEntry = false,
|
||||
args = {},
|
||||
env = env,
|
||||
},
|
||||
{
|
||||
-- Any standalone Odin project: plain `odin build .` with debug info.
|
||||
name = "Launch (odin build .)",
|
||||
type = "codelldb",
|
||||
request = "launch",
|
||||
program = function()
|
||||
vim.fn.system({ "odin", "build", ".", "-o:none", "-debug", "-out:.debug_out" })
|
||||
return root .. "/.debug_out"
|
||||
end,
|
||||
cwd = root,
|
||||
stopOnEntry = false,
|
||||
args = {},
|
||||
},
|
||||
{
|
||||
-- Single-file Odin programs (hello.odin, small scripts)
|
||||
name = "Launch (current file)",
|
||||
type = "codelldb",
|
||||
request = "launch",
|
||||
program = function()
|
||||
local src = vim.fn.expand("%:p")
|
||||
local out = vim.fn.expand("%:p:r") .. "_debug"
|
||||
vim.fn.system({ "odin", "build", src, "-o:none", "-debug", "-out:" .. out })
|
||||
return out
|
||||
end,
|
||||
cwd = "${workspaceFolder}",
|
||||
stopOnEntry = false,
|
||||
args = {},
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
-- ─────────────────────────────────────────────────────────────────────────
|
||||
-- DAP UI keymaps + auto open/close (the spec itself is loaded as a dep above)
|
||||
-- ─────────────────────────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user