Sandbox
The Sandbox is an environment in which protocols can be deployed in a lightweight local environment. It can be accessed via the plugin.
Loading code
Ultimately source code must be loaded into an engine for it to turn into executable code. The plugin provides ways to do this quickly.
On the fly
Sandbox environments can be started by writing a function that takes no input arguments and returns Unit
.
function start() {
// Setup...
};
The plugin will show a small Play
button to the left of such a function, which will start a sandbox environment with
the relevant file loaded when pressed.
Panes
Once the sandbox has started up, the Run
pane will appear. It contains the following tabs:
Console
This is the only window that is available right after the start, the others are displayed only as soon as the engine connects. This presents a log from the run. Moreover, if "Server" is set to "Start new", this will also contain the log from the Engine application.
Protocols
List of all constructed protocols on the server. Selecting a protocol instance will navigate to the source location of the protocol, if it can be found.
Commands
Shows all commands that have been executed since the server was started. The view can be emptied by pressing the Clear
button. Note that this does not clear the commands on the server.
Executing actions
The Protocol
tab serves another purpose. When a protocol is selected and navigated to in the source viewer, Run
icons will appear in the gutter next to actions that are applicable in the given state. Clicking on the icon executes
the action.
Note that the icon will not be available if there are dirty protocol states pending.
If the action can be performed by multiple parties, a window appears prompting for the actual party to execute this
action with. Here, pressing the return key or clicking on a party continues the execution, whereas pressing Esc
or
clicking outside aborts.
When the action has some parameters, a simple window to enter them is shown. Note that you must match the signature of the function exactly, otherwise you will receive an error (no syntax highlighting or error marking is performed in this window yet). You can use arbitrary expressions here, including calling built-in or user-defined functions.