VS Code DAP Debugger
The VS Code DAP debugger is a Professional tier feature.
Overview
Section titled “Overview”The codegen VS Code extension integrates the LuaU debugger via the Debug Adapter Protocol. You can:
- Set breakpoints in
.luaurule scripts - Inspect the
nodevariable (the decoded AST entity) at any point - Step into
json.decode/json.encodeboundary calls - Watch local variables and the call stack
-
Install the extension
Search for
codegenin the VS Code Extensions marketplace and install. -
Add a launch configuration
.vscode/launch.json {"version": "0.2.0","configurations": [{"name": "Debug codegen Rule","type": "codegen","request": "launch","config": "${workspaceFolder}/.codegen/rules/ToString/ToString.config.yaml","input": "${workspaceFolder}/include","output": "${workspaceFolder}/generated","stopOnEntry": true}]} -
Set a breakpoint
Open any
.luaurule script and click the gutter to set a breakpoint. -
Start debugging
Press
F5or use the Run menu. The engine starts, pauses at your breakpoint, and VS Code shows the current LuaU locals including the fullnodetable.
Inspecting the AST in the debugger
Section titled “Inspecting the AST in the debugger”When paused inside the transformation script, expand the node variable in the Variables panel to navigate the full AST. This is often the fastest way to understand the exact shape of the JSON your rule receives for a specific entity.
Limitations
Section titled “Limitations”- The debugger attaches to a single rule run. It does not support multi-rule sessions.
- Breakpoints in
preamble.luauandgrouping.luauare supported. - Hot-reload (editing the script while paused) is not supported, restart the debug session after edits.
- The debugger uses DAP, no custom protocol, no port to configure. Works with the standard VS Code debug UI.
- Inspect
nodedirectly in the Variables panel to understand the AST shape for a specific entity. - Breakpoints work in transformation, preamble, and grouping scripts.
- Requires Professional tier license.