8.1. Visual Studio Code

Halon has a fully-featured integration with Visual Studio Code that leverages Visual Studio Code Remote Development which allows you to connect to a container or remote machine (where Halon is installed) to work with it’s configuration, including linting and debugging it’s Halon script (HSL) source files.

8.1.1. Extensions

Below is a list of the extensions we provide and whether they should be installed locally or remotely. If both options are marked it can be installed either locally or remotely depending on the use case.

Extension

Local

Remote

Marketplace

Halon Configuration Packer

Install

Halon Scripting Language Syntax

Install

Halon Scripting Language Linter

Install

Halon Scripting Language Debugger

Install

8.1.1.1. Configuration Packer

Provides a configuration packer for Halon. It also provides a linter for the configuration files.

Note

This extension can be installed either locally or remotely depending on the use case. When installed locally it can also be used to quickly setup a development environment.

Run the Halon: Build command to package the configuration files. If you don’t have an existing configuration you can run the Halon: Init command and select a configuration template.

_images/vscode-conf.png

The autocomplete and linter for the YAML configuration files in action

8.1.1.2. HSL Syntax

Provides syntax highlighting for Halon script (HSL) source files.

_images/vscode-syntax.png

The Halon script (HSL) syntax highlighting in action

8.1.1.3. HSL Linter

Provides a linter for Halon script (HSL) source files.

Note

This extension should only be installed remotely.

_images/vscode-linter.png

The Halon script (HSL) linter in action

8.1.1.4. HSL Debugger

Provides a debugger for Halon script (HSL) source files.

Note

This extension should only be installed remotely.

Launch configuration snippets are available under the Halon Scripting Language namespace when the extension has been installed. Use the Debug File snippet if you want to debug a HSL module inside the src/files folder using our script interpreter or the Debug Live Stage snippet if you want to debug the smtpd process when using blue-green testing.

If you open the .vscode/launch.json file that gets created you can add conditions to the Debug Live Stage snippet to limit which incoming connections the test configuration gets applied for, such as probability or remoteips:

{
  "name": "Debug Live Stage",
  "type": "halon",
  "request": "launch",
  "conditions": {
    "probability": 0.01,
    "remoteips": [
      "10.2.55.20"
    ]
  }
}
_images/vscode-debug.png

The Halon script (HSL) debugger in action

8.1.2. Setting up a development environment

To quickly setup a development environment using a container and Docker Desktop, simply install the Halon Configuration Packer extension locally, open a new empty folder, run the Halon: Init command and when the selection for Remote development comes up, pick the container option. After this, follow the instructions in the README.md file that opens up to get started.

See Developing inside a Container for more information about how this works.