Tools › VS Code extension

Tools

The VS Code extension

What the extension does once installed (see the README to install it). Open any folder with .arche files. You get:

  • Highlighting: keywords, declarations, units (50ms, 2Mbps), LaTeX inside $…$, Python inside ```python blocks, YAML inside ```yaml; ```arche blocks in Markdown too. A ```arche body is coloured as the action language — var, if/while/for, send port MSG { field: … }, goto State, the builtins, calls, operators — and by meaning: the component's variables, its functions and ports, a message and its fields, a parameter, a local. arche.bodies.highlight puts a faint background behind each body.
  • Live diagnostics: syntax and the full lint set, across includes. A file is checked in the context of the file that includes it.
  • Quick fixes for every "did you mean …?".
  • Completion: keywords and properties for the block you are in, members after . (adcu. → its ports, functions, children, including those of its definition), messages after sends [, port types after port x:, types after var x:, states in transitions, include paths. After part x: the boards of the store and of your collections too, with vendor and part number (one the model does not include yet brings its include and the project's uses); in pins { … } the roles, then the board's pins and what each is wired to; in a part of a board, its connectors with their pins.
  • Hover on any name: its declaration, documentation, ports/functions/fields; on keywords and properties: their documentation and an example. On a board (or a part of one): vendor, part number, URL, its processors with core, clock and memory, its connectors and the pins they are wired to; on a pin in pins { … }: the chip it is on and what the board wires to it. A pin the board's chip does not name so is a warning (board-pin), with the nearest as a quick fix.
  • Signature help in bodies: while you build a message (BRAKE_CMD { force: … } in an ```arche body, BRAKE_CMD(force=…) in Python), its fields with their types, units and ranges, the one you write highlighted; on send port MESSAGE (send(port, message)), the ports that send, then the messages the port carries.
  • Go to definition, find references, rename across files, outline, workspace symbols (⌘T), format document. In a ```arche body too, by what each name is: Ctrl+click on got goes to the component's var got, on bump() to its fn bump, on send o TRACK { id: … } to the port, the message and its field; a parameter goes to the function's signature, a local to its var. Renaming a message's field renames it in the records of the bodies, and leaves a parameter of the same name; renaming a parameter or a local stays in its body.
  • Models in JavaScript and TypeScript: a model written in a test as archeSrc`…` (test/helpers.js; its fences written \`\`\`) is coloured as arche, and Ctrl+click and hover work on its names, each string compiled as a model of its own. arche.embedded.problems shows its errors in the Problems view (off by default: a test's model may be wrong on purpose).
  • Inlay hints: what archec computed, after the line that gives it: 2 * TICK + 500us = 2.5ms, 2.5kHz = 400us period, period TICK = 1ms; component LidarFront extends Lidar inherits ports cloud, power; budget power 10W = 8.5W of 10W (the checker's roll-up, ⚠ when over); a deployment thread R=200us/D=1ms (the timing analysis); part s: Sensor[N] = 4 parts. A plain quantity gets none. arche.inlayHints.enabled turns them off.
  • Semantic highlighting: each name is coloured by what it resolves to — definition, part, port, message or type, requirement, state, function, variable or constant, deployment, thread — and a quantity's unit apart from its number. The grammar still colours the rest.
  • Simulation debugger (Run › Start Debugging, or Debug Test on a case in the Testing view): a test case runs in simulation with arche-cli, and you step through its run event by event. The call stack is the event, at the line it is about: a message at the function it ran (or the transition it fires, or the case line that sent it), a state change at the state, an expectation at its expect line. Variables has the time, the event (message, from, to, function), every component's state, the expectations checked so far and the count of each message sent; hover or watch time, adcu.state, sent("BRAKE_CMD"). Breakpoints go on .arche lines, a failed expectation stops the run (Failed expectations and errors), and step back and reverse continue work, since the run is recorded. Step over goes to the next event, step out to the next instant. A launch.json entry is { "type": "arche", "request": "launch", "program": "${workspaceFolder}/main.arche", "case": "TP-AEB/TC-AEB-01" }; without case you pick one. A recent arche-cli keeps the trace records with --trace (PLAN__CASE.trace.json, variable writes included), so a run also has a Variables scope: each component's variables as they stand at the event. "trace" replays a trace exported from the Arche app the same way. Limits: a run is at most 50 000 records. An older arche-cli keeps only the sequence view: no variable values, a state change timed at the event before it, at most 2000 events, and the run of a failing case only. With it, the debugger builds its own copy of the project and adds one last step that fails on purpose (expect False). That step is not shown, and a case that passes is reported as passing.
  • Diagram to the side (⌘K V, or the diagram button in the editor title), drawn in the Arche canvas theme (light or dark, following VS Code; arche.diagram.theme forces one): the system's blocks with their ports as coloured dots and links with pill labels, every state machine and every scenario. It uses your positions (canvas lines, or at on a part) when all parts have one (else an automatic layout; Layout toggles), updates as you type, and follows the cursor.
  • Arche actions on the drawing, as on the Arche canvas — each one edits your .arche source (one undoable step):
    • click a block, port, link or state: it is selected, what is not connected fades, the source is revealed, and the properties panel shows its identity — Rename… (everywhere, through the language server), name, description, kind, layer, colour, tags; a port's direction, type, sends / receives; a link's name, messages and Flip;
    • drag a block to move it (writes its line in the system's canvas block when there is one, else at x, y on the part; on an automatic layout the first move keeps every block where it is);
    • drag from a port to a port to link them; in a state machine, drag from a state to another to add a transition;
    • double-click a block to go inside, a link to name it; Del deletes the selection; + adds a part (or a state).
  • The palette (left of the diagram, ‹ hides it): the core elements (component, part, in / out port, function, link, state), the boards of the board store and of your collections, and the packages of the configured Arche Store (arche.store), with a search box (esp32 can). Drag an item onto the canvas, or click it to add it in the middle: a component or a part where it falls, a port or a function on the block under the pointer, a board as archec board add writes it (its part, its include, the uses of its collection — in a new hardware system when the diagram shows none), a store package once you said yes to the code it brings (installed into .arche/store, then its uses, its include and a part of its main component). The User interface section holds a Screen, a Dialog, an Overlay, the layouts and the elements of a ui { }: dropped on a block, they go into its definition's ui. Each drop is one undoable edit. Each item's tooltip says what it is and how it is written. Boards and packages dragged from the Boards and Store views are taken too (VS Code wants Shift held to drop into a webview).
  • Property forms: under the properties panel, a selected part, component or port has a field per property its declaration takes, generated from the language's description (src/spec.ts) and grouped as the language groups them (compute, timing, delivery, physical, product, integrity, traceability): a dropdown for a choice (os, pattern) or the names in scope (satisfies requirements, variants), a checkbox for yes/no, a number and a unit for a quantity (power 15W, latency 2ms), each with the property's documentation as its help. A value is checked before it is written (a number, a unit of that quantity, a declared name) and the error shows under the field.
  • Get started with arche-lang (Help › Welcome › Walkthroughs, or Arche: Get Started with arche-lang): understand the concepts, create a project, add a component, add a board from the palette, wire a sensor, run the simulation, generate C. Each step ticks itself when the model (or the workspace) shows it done; the first, once the cheat sheet is open. arche-lang: Show Cheat Sheet opens the cheat sheet at any time.
  • Convert to arche body: a ```python body that says only what the action language says has a hint, and this quick fix writes it as a ```arche body (fixes).
  • Arche side bar: click the Arche icon in the activity bar to browse the model as in the Arche app — Model (systems → components → ports, functions, variables, memory, state machine, requirements; then definitions, messages, data types, constants, requirements, actors, missions, scenarios, test plans, traces, catalogs) and Files (the include tree). Click jumps to the source; the inline buttons open the diagram and add a part; right-click for Add part / port / function / state, Rename…, Set name…, Set kind…, Delete. The tree follows the model of the file you edit; Select the model to browse pins one.
  • Commands (⇧⌘P → "Arche"): Build Project (also the ▶ button in the editor title), Export LaTeX Specification…, Open in Arche (runs arche --project … and opens the browser), Validate Project Folder…, Show Pattern Reference.

Settings: arche.outputDirectory (default arche-out), arche.entry, arche.paths.app (the Arche app: point it at arche/dist/arche-darwin-arm64), arche.port, arche.buildOnSave, arche.lint.minimumSeverity, arche.format.indent, arche.diagram.theme (auto | light | dark).