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 language server and the CLI from the repository of Stellar Control:
Shell cargo install --path tooling/lsp # stellar-lsp cargo install --path tooling/cli # stellar -
Install the extension: download
stellar-mcs.vsixfrom the artifacts of the CI (job VS Code extension), then:Shell code --install-extension stellar-mcs.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 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 the MCS (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 example repository, 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" }),
})From source#
cd tooling/vscode
npm ci
npm test # unit and highlighting tests
STELLAR_CLI=../../target/debug/stellar npm run package # schemas, bundle, stellar-mcs.vsixTo try it from source, open tooling/vscode in VS Code and run Run Extension (F5) with
stellar.server.path pointing to target/debug/stellar-lsp.