This script automatically generates a .vscode/launch.json
file for your project, based on the presence of certain marker files.
- Go:
go.mod
- TypeScript/JavaScript (Vite):
package.json
- Rust:
Cargo.toml
- Python:
.py
files with shebang or__main__
The script searches for these marker files in your project directory. Based on the markers found, it generates corresponding debug configurations for VS Code / Neovim.
- Download the latest release for your platform from the Releases page.
- Make it executable (if necessary):
chmod +x debuggen-linux # For Linux chmod +x debuggen-macos # For macOS
- Run the executable:
./debuggen-linux # For Linux ./debuggen-macos # For macOS
This will create a .vscode/launch.json
file in your project root.
To build the executable yourself, run:
make build
The executable will be created in the dist
directory.
- Automatically detects project types based on marker files.
- Generates debug configurations for Go, TypeScript/JavaScript, Rust, and Python.
- Respects
.gitignore
to exclude files and directories from the search.
If you're using Neovim, feel free to check out my configuration to make everything work seamlessly:
-- Inside your nvim-dap configuration
-- setup dap config by VsCode launch.json file
local vscode = require("dap.ext.vscode")
local json = require("plenary.json")
vscode.json_decode = function(str)
local clean_str = json.json_strip_comments(str)
clean_str = clean_str:gsub('"type"%s*:%s*"lldb"', '"type": "codelldb"')
clean_str = clean_str:gsub('"type"%s*:%s*"debugpy"', '"type": "python"')
clean_str = clean_str:gsub('"type"%s*:%s*"go"', '"type": "delve"')
clean_str = clean_str:gsub('"type"%s*:%s*"chrome"', '"type": "pwa-chrome"')
clean_str = clean_str:gsub('"preLaunchTask"%s*:%s*"rust: cargo build"', '"preLaunchTask": "cargo build"')
return vim.json.decode(clean_str)
end
vscode.load_launchjs(nil, {
go = { "go" },
python = { "py" },
gdb = { "c", "cpp", "rust" },
lldb = { "c", "cpp", "rust" },
codelldb = { "c", "cpp", "rust" },
cppdbg = { "c", "cpp", "rust" },
})
I also recommend using nvim-dap-vscode-js to provide a working JS/TS debuggnig experience.
Contributions are welcome! Feel free to open issues or pull requests.