Procedures are written by operators, not only by developers: the tooling that catches errors
while they type is part of the product. stellar-lsp is the language server of the
configuration repositories, built on the same compiler as stellar check and the CI: what the
editor reports is what the CI reports. The VS Code extension is its first client; the
web editor is the second.
Installation#
-
Install the CLI and the language server from get.stellar-systems.eu:
Shell curl -fsSL https://get.stellar-systems.eu/install.sh | sh # stellar curl -fsSL https://get.stellar-systems.eu/install.sh | sh -s -- --product stellar-lsp # stellar-lspBoth land in
~/.local/bin(or/usr/local/binas root), which must be on thePATH. See CLI Reference for the options of the script. -
Install the extension,
stellar-vscode-<version>.vsixon get.stellar-systems.eu:Shell curl -fsSLO https://get.stellar-systems.eu/stellar-vscode/0.1.0/stellar-vscode-0.1.0.vsix code --install-extension stellar-vscode-0.1.0.vsixor Extensions: Install from VSIX… in VS Code. The extension needs VS Code 1.90 or later, and installs the YAML extension of Red Hat with it.
-
Open the configuration repository: the folder with
topology.yamlorpackages/. The extension activates on a workspace that containstopology.yamlorpackages/*/catalogue.yaml.
Features#
Procedures (.proc)#
- Highlighting of the procedure language.
- Live errors and warnings, such as a hazardous telecommand without
ask operator, an unknown measure, a unit mismatch or aretryon a step that changes the on-board state. - Completion by role, from the roles (
uses) of the block being written:- after
psu., the components and measures of the catalogue of the power supply; - after
send, the telecommands of the platforms of the roles, and afterwith, their arguments; - after
isoris not, the enum and boolean values; - after
do "orrun ", the steps and procedures of the library; - at the start of a line, the keywords.
- after
- Hover:
- on a step (defined, inline or called): the maximum duration of an attempt, the retry as
written (that of the call wins) or deduced (
executor.default_retrywhen all its telecommands arechanges_state: false, else none), its hazardous telecommands; - on a procedure: its maximum duration retries included, whether
run … retryis allowed, its environments, its signature; - on a telecommand or a measure: type, unit, range, limits, description.
- on a step (defined, inline or called): the maximum duration of an attempt, the retry as
written (that of the call wins) or deduced (
- Go to definition of a step, a procedure, a telecommand, a measure or a component, down to its catalogue (or the catalogue it is imported from).
YAML files#
The catalogues (packages/*/catalogue.yaml), library manifests (packages/*/package.yaml), the
topology (topology.yaml) and simulations (simulations/*.yaml) get:
- their JSON Schema, through the YAML extension of Red Hat: completion of keys, hover, and
structural errors (the same schemas as
stellar schema catalogue|library|topology|simulation); - the errors of the compiler: cross-references, types, units, policies.
Commands#
| Command | Effect |
|---|---|
| Stellar: Check the repository | Runs stellar check: diagnostics, and what must be validated again |
| Stellar: Dry run the procedure | Runs the procedure under the cursor with stellar run --dry, asking for its inputs; on a run request (.yaml), runs that request. Also the ▷ button of the editor title of a .proc file |
| Stellar: Restart the language server | Restarts stellar-lsp |
A dry run needs nats-server, the binary of the message bus, on the PATH (or STELLAR_NATS_SERVER). See
Simulated Targets.
Settings#
| Setting | Default | Meaning |
|---|---|---|
stellar.server.path | stellar-lsp | The language server: a path, or a name on the PATH |
stellar.cli.path | stellar | The CLI, for the check and dry runs |
stellar.config | empty | Global configuration of Stellar Control (STELLAR_CONFIG): compilation parameters such as executor.default_retry; empty, the defaults |
stellar.dryRun.speed | 1 | Speed of the simulated time of dry runs (--speed, at least 0.1) |
The language server#
stellar-lsp speaks the Language Server Protocol on standard input and output, so any editor
with an LSP client can use it.
- Repository root. The repository of a file is the first directory above it that contains
topology.yamlor apackages/directory. Several repositories can be open at once. - Compilation. It compiles the whole repository with the compiler of the CLI and the CI, the unsaved buffers of the editor over the files on disk, 100 ms after the last change.
- Diagnostics are published file by file — catalogues, topology, procedures and simulations — and cleared once fixed. On the repository of a use case, they arrive within 200 ms of a keystroke, delay included.
- Completion triggers on
.,"and space. - Compilation parameters (
executor.default_retry,derived.max_window) come from the global configuration named bySTELLAR_CONFIG; defaults without it. - Logs go to standard error, at
warnunlessRUST_LOGsays otherwise.
For other editors, run stellar-lsp for .proc files and the YAML files above; for instance
with Neovim:
vim.lsp.start({
name = "stellar-lsp",
cmd = { "stellar-lsp" },
root_dir = vim.fs.root(0, { "topology.yaml", "packages" }),
})