Overview and installation

View source

What the Actus extension for VS Code adds to the language server, how to install it, and how it finds, downloads and verifies the compiler.

The extension is called Actus Language Support. Its publisher is actus-lang and its identifier is actus-lang.vscode-actus. It is a separate program from the compiler. It starts actus lsp for you, so what the editor shows is what the compiler knows. The Editor support page describes that server. This page says what the extension adds.

What it adds

  • A language for .act files. Files that end in .act open as Actus, with syntax colours, # line comments, """ documentation blocks and the snippets.
  • Role colours. The four roles have their own colours and are bold, both in the syntax colours and in the semantic tokens of the server. See Settings reference.
  • The language server client. It runs actus lsp in your workspace folder and gives you errors, hover, go to definition, completion, rename, formatting and quick fixes, as far as the server offers them. A quick fix named Explain Actus E1005 is added to every diagnostic that has a code. It opens the text of actus explain beside the editor.
  • A toolchain installer. If the compiler is not on your machine, the extension downloads and checks it. See below.
  • The ownership panel. A panel next to Terminal and Problems that lists, for each verb, every participant with its role, its state and what happened to it. See The ownership panel.
  • Tests. The meta test verbs of the workspace show up in the Test Explorer. See Tests in VS Code.
  • Commands, tasks and a status bar item. See Commands, tasks and the status bar.
  • A new-project wizard and a helper that copies the configuration of actus mcp.

What you need

  • VS Code 1.85 or newer.
  • A trusted workspace. In a workspace that is not trusted the extension does not start the compiler and does not run any command. The Language Server view shows Workspace trust is required. When you trust the workspace, the server starts.
  • A compiler that the extension accepts. After the server starts, the extension checks that it is Actus 0.1.0 or newer and that it speaks version 1 of the protocol and of the schema of the Actus requests. If it does not, the server is stopped and the status says why, for example Actus compiler 0.1.0 or newer is required. The panel history described in The ownership panel needs the data that Actus 0.3.0 sends.
  • What a program needs to run. The extension only installs the compiler. To run a program you also need a C compiler on Linux and macOS, and Build Tools for Visual Studio on Windows. See Install for the details.

Install the extension

The extension is Actus Language Support on the Visual Studio Marketplace (opens in a new tab). Its identifier is actus-lang.vscode-actus. Install it in one of these ways:

  • Open the Extensions view (Ctrl+Shift+X, on macOS Cmd+Shift+X), search for Actus, and choose Install on Actus Language Support.

  • Open Quick Open (Ctrl+P, on macOS Cmd+P), paste the line below and press Enter:

    text
    ext install actus-lang.vscode-actus
  • In a terminal:

    bash
    code --install-extension actus-lang.vscode-actus

By default, VS Code updates the extension when a new version is published.

Actus Language Support in the Extensions view of VS Code: the search for Actus on the right, and the page of the extension with its Install button and the identifier actus-lang.vscode-actus.

Install from a VSIX file

Each release of the extension repository, github.com/actus-lang/vscode-actus, also has the extension as a VSIX file, named like vscode-actus-0.2.0.vsix, together with a SHA256SUMS file. Use it when you cannot reach the Marketplace:

code --install-extension vscode-actus-0.2.0.vsix

You can also open the Extensions view, choose the menu ... at the top and then Install from VSIX....

Then open a .act file, or a folder that has an Actus.toml. The extension starts when it sees an Actus file, and when VS Code has finished starting.

How the extension finds the compiler

When you set nothing, the extension looks for actus in this order and uses the first one that exists:

  1. target/debug/actus in your workspace folder. This is for people who build the compiler in the folder they have open.
  2. ../actus/target/debug/actus, next to the folder of the extension.
  3. actus on your PATH.
  4. current/bin/actus in the Actus folder: the folder in ACTUS_HOME when that variable is set, %LOCALAPPDATA%\Actus on Windows, and ~/.actus on the other systems. This is where the install script puts it.
  5. The folder that VS Code keeps for the extension, in toolchain/current/bin.
  6. ~/.cargo/bin/actus.

If you set actus.lsp.path to another value, that path is used. If the file is not there, the extension writes a line in its output and falls back to the list above.

If none of them is found, the extension installs the compiler, as the next section says.

The toolchain installer

What it does depends on the setting actus.toolchain.autoDownload:

ValueWhen the compiler is not found
autothe extension installs it at once. This is the default.
promptthe extension asks: Install Actus, Manual Install or Not Now.
offthe extension installs nothing. The status says the compiler is missing.

The installer works for the systems that have a release: Linux on x86-64, macOS on arm64 and Windows on x86-64. On another system it stops with the message that there is no prebuilt release.

It is only used when the path is the default one. If actus.lsp.path names a file that does not exist and no actus can be found, the extension does not install anything.

What it downloads and checks

For the version in actus.toolchain.version the installer does these steps. The value latest means the newest release, which the extension finds by following the redirect of https://github.com/actus-lang/actus/releases/latest.

  1. It downloads SHA256SUMS of the release from https://github.com/actus-lang/actus/releases/download/v<version>/.
  2. It downloads the archive for your system from the same place: actus-<version>-x86_64-unknown-linux-gnu.tar.xz, actus-<version>-aarch64-apple-darwin.tar.xz or actus-<version>-x86_64-pc-windows-msvc.zip.
  3. It computes the SHA-256 of the archive and compares it with the entry in SHA256SUMS. If they differ, or if the file has no entry, it stops and installs nothing. The checksum file comes from the same release as the archive, so it protects you from a damaged download.
  4. It unpacks the archive into a staging folder. This uses tar with xz support on Linux and macOS, and Expand-Archive of PowerShell on Windows.
  5. It runs actus --version from the unpacked folder. If that fails, it stops.
  6. It moves the folder to toolchains/actus-<version>-<system> and points current at it.

A notification shows the progress and has a Cancel button.

The install folder is the same as the one of the install script, so the script and the extension share one toolchain. It is the folder in ACTUS_HOME, or %LOCALAPPDATA%\Actus on Windows, or ~/.actus:

ItemLinux and macOSWindows
Each version~/.actus/toolchains/<archive name>%LOCALAPPDATA%\Actus\toolchains\<archive name>
Current version~/.actus/current (a link)%LOCALAPPDATA%\Actus\current (a junction)

If the folder of the version is already there, it is replaced. If the installation fails, a message shows the reason and the button Manual Install. The button offers the command of the install script for your system and a link to actus-lang.org.

The extension does not change your shell profile or your user Path. It only puts the folder of the compiler in front of PATH in the integrated terminals of VS Code, which is what actus.toolchain.addToTerminalPath controls. A terminal that is already open keeps the old PATH; open a new one.

Install or update by hand

Two commands in the Command Palette work without the setting:

  • Actus: Install / Update Toolchain installs the version of actus.toolchain.version now, whatever actus.toolchain.autoDownload says. When it is done, the language server restarts.
  • Actus: Check Toolchain Version compares the compiler that the extension found with the newest release. If a newer one exists, a message offers Update Now. If no compiler is found, it offers Install Actus.

The extension looks for a newer release only when you run Check Toolchain Version, or choose Check / Update Actus Toolchain in the Quick Actions. It does not check in the background.

Check that it works

Open a .act file. In the status bar, at the left, you see an item like this:

text
$(actus-logo) Actus v0.3.0 · debug · host

The first part is the Actus icon when the server is ready, a spinning icon while it starts and a warning icon when it is not available. The version comes from the server. Hover over the item to see the state and the detail. Click it to open the Quick Actions.

The Actus icon in the Activity Bar has a view called Language Server. It lists four lines: State (starting, ready or unavailable), Target, Compiler (the path that is used) and Detail. When it is ready, the detail is Compiler-backed features are available.

The Output panel has a channel called Actus Language Server. It shows the command that was started, for example starting /home/you/.actus/current/bin/actus lsp for host, and what the server writes to its standard error. Look there first when something does not work.

Changing any actus.* setting, the workspace folders or the trust of the workspace restarts the server. Restart Actus Language Server in the Quick Actions does it by hand.

What you learned

  • The extension adds an installer, the ownership panel, tests, tasks and a status bar to the language server of the compiler.
  • It installs from the Visual Studio Marketplace as actus-lang.vscode-actus, or from a VSIX file. It needs a trusted workspace.
  • It looks for the compiler in a fixed order, and with the default setting it downloads, checks and installs it when it is missing.
  • The installer uses the same folder as the install script.

Next: The ownership panel.