Rename from tiny-debugger to turbo-debug — inspired by Turbo Pascal, the first IDE with a real visual debugger. This thing isn't tiny, it's turbo charged. CHANGELOG for 0.1.0: Features: - Zero-config debugging — one line install, everything works - Modal keybindings (c/s/d/r/q/x/X/D/W/K/E/R/?), active only during debug mode, cleanly removed on exit - Persistent breakpoints via persistent-breakpoints.nvim - Inline virtual text — variable values in source code - Hover (K), watch (W), REPL eval (E) from the code window - Help splash (3s auto-dismiss) + manual help (?) - Debug mode chrome — winbar indicator, cursor highlight - dapui integration — controls toolbar, labeled panels - which-key support — <leader>d debug group auto-registered - quit_exits_mode option Adapters (12 languages): - Python (debugpy + venv detection) - Rust (codelldb + cargo build + vim.ui.select picker) - Go (delve), C/C++/Swift (codelldb) - JavaScript/TypeScript (js-debug-adapter) - C# (netcoredbg), Java, Kotlin, PHP, Ruby, Lua (osv) Keybindings: - <leader>dd — toggle debug mode - <leader>dx / <leader>dX / <leader>dD — breakpoints (always) - c s d r C x X D W K E q R ? — modal (debug mode only)
53 lines
1.3 KiB
Lua
53 lines
1.3 KiB
Lua
local loader = require("turbo-debug.adapters.init")
|
|
|
|
local M = {}
|
|
|
|
local function find_python()
|
|
-- check active virtualenv
|
|
local venv = vim.env.VIRTUAL_ENV
|
|
if venv then
|
|
local path = venv .. "/bin/python"
|
|
if vim.fn.executable(path) == 1 then return path end
|
|
end
|
|
|
|
-- check conda
|
|
local conda = vim.env.CONDA_PREFIX
|
|
if conda then
|
|
local path = conda .. "/bin/python"
|
|
if vim.fn.executable(path) == 1 then return path end
|
|
end
|
|
|
|
-- probe common venv directories relative to cwd
|
|
local cwd = vim.fn.getcwd()
|
|
for _, dir in ipairs({ ".venv", "venv", "env", ".env" }) do
|
|
local path = cwd .. "/" .. dir .. "/bin/python"
|
|
if vim.fn.executable(path) == 1 then return path end
|
|
end
|
|
|
|
-- fallback to system python
|
|
if vim.fn.executable("python3") == 1 then return "python3" end
|
|
if vim.fn.executable("python") == 1 then return "python" end
|
|
return nil
|
|
end
|
|
|
|
function M.register(dap)
|
|
local python = find_python()
|
|
if not python then return end
|
|
|
|
loader.register(dap, "debugpy", {
|
|
type = "executable",
|
|
command = python,
|
|
args = { "-m", "debugpy.adapter" },
|
|
}, {
|
|
{
|
|
type = "debugpy",
|
|
request = "launch",
|
|
name = "Launch file",
|
|
program = "${file}",
|
|
pythonPath = function() return find_python() end,
|
|
},
|
|
}, { "python" })
|
|
end
|
|
|
|
return M
|