-
Notifications
You must be signed in to change notification settings - Fork 82
Setting up Debugging
- Install the DreamMaker Language Client extension for Visual Studio Code.
- Press Ctrl+Shift+D to access the Debug view.
- Click the gear icon
to create the launch configuration.
- From now on, pressing F5 will build and run the project.
- Download a recent extools.dll release and place it alongside your
.dme
file. - Add this snippet to your codebase and call it early in your initialization, for example at the top
of
/world/New()
:/world/proc/enable_debugger() var/dll = world.GetConfig("env", "EXTOOLS_DLL") || (fexists("./extools.dll") && "./extools.dll") if (dll) call(dll, "debug_initialize")()
- The debugger will automatically activate when the project is run with F5.
For a general overview, read Debugging in Visual Studio Code.
Edit launch.json
and remove or comment out the "preLaunchTask"
line.
Ctrl+F5 will launch without debugging. The debugging hooks will not be enabled when running from outside Visual Studio Code.
Activate BACKGROUND or BLOCK mode as described in
Environment variables. When editing launch.json
,
click "Add Configuration" and choose "BYOND: Attach to debugger". Ensure the
port numbers match.
The environment variables EXTOOLS_DLL
, EXTOOLS_MODE
, and EXTOOLS_PORT
are set when
running from within Visual Studio Code. They can be read with the
world.GetConfig
proc. The first parameter to debug_initialize
will override EXTOOLS_MODE
and the second parameter will override
EXTOOLS_PORT
. The default mode is NONE and the default port is 2448.
The available modes are:
- LAUNCHED: connect out to the given port.
- BACKGROUND: listen for connections on the given port in the background.
- BLOCK: wait for a connection on the given port before resuming.
EXTOOLS_DLL
is set to a path to a .dll
bundled with and compatible with the current
version of the language server. It can be overridden by changing the code of enable_debugger
.