Editors¶
The Goose compiler is its own language server, and Goose ships an extension
for Visual Studio Code that starts it. microgoose new sets the project
folder up for that extension, so opening the folder is enough: errors as you
type, hover, go to definition into import mcu;, and Ctrl+Shift+B to
build and run the program on the board.
VS Code¶
Make a program:
microgoose new hello
Besides hello/main.goose, it prints the command that installs the Goose
extension, once. The extension isn't on the Marketplace: it comes with the
Goose compiler that MicroGoose downloads, as
~/.microgoose/goose/goose-v2026.5-<platform>/vscode/goose-language.vsix.
Run the command it prints, or in VS Code, run Extensions: Install from
VSIX... and pick that file. If it says to run microgoose setup first,
the compiler isn't downloaded yet: run that, then microgoose vscode
hello/main.goose to see the command.
Then open the folder:
code hello
Say yes when VS Code asks whether you trust the folder: the extension runs
the compiler only in a trusted folder. Open main.goose.
| What | How |
|---|---|
| Errors and warnings | as you type, underlined, and in Problems |
| What a function is | hover over it: millis shows extern fn millis() -> i64 |
| Where it is defined | F12 on millis opens MicroGoose's mcu.goose |
| Run on the board | Ctrl+Shift+B (Terminal > Run Build Task) |
| The other tasks | Terminal > Run Task..., the ones named MicroGoose |
The tasks are:
| Task | Runs |
|---|---|
| MicroGoose: run on the board | microgoose run main.goose --target s3, the default build task |
| MicroGoose: build | microgoose build main.goose --target s3 |
| MicroGoose: monitor the board | microgoose monitor --target s3 |
| MicroGoose: run in the emulator | microgoose run main.goose --target s3 --emulate (see emulators) |
| MicroGoose: files for Velxio (velxio.dev) | microgoose velxio main.goose (see Velxio) |
A compiler error in a task's output links to its line, as the editor's own errors do.
microgoose new hello --target h7 makes the tasks build for the STM32H743
instead (or esp32); an example with a circuit, such as
--example velxio/traffic, builds for the WROOM-32 that Velxio simulates.
What it writes¶
microgoose new writes two files in the folder's .vscode/:
settings.jsonpoints the extension at the Goose compiler MicroGoose uses (goose.compilerPath) and at MicroGoose's library (goose.stdlibPath). The compiler looks for an imported module beside the program, then in that folder, then in Goose's own standard library, soimport mcu;,import net;,import std;andimport math;all resolve as they do in a build. It also turns off the extension's own Ctrl+Shift+B and F5 (goose.useRunKeybindings), which would run the program on your computer, where it has no board to call.tasks.jsonholds the tasks above. They runmicrogoose, or, where Windows won't run that command or it isn't on PATH, the Python that MicroGoose is installed in, with-m microgoose.
Both hold full paths on this computer, so they aren't meant for version control.
An existing folder, another board, an upgrade¶
microgoose vscode writes the same files for a program that is already
there. It takes the program's file (main.goose by default) and the board:
microgoose vscode blinky/main.goose --target esp32
It leaves a .vscode file that is different alone and says so; --force
replaces it. Run it with --force after upgrading MicroGoose, whose newer
release may use a newer Goose compiler.
What the extension's Run does¶
The extension's Run above main, its play button and Goose: Run with
JIT run the program on your computer, not on a board. A program that calls
mcu functions fails there with unresolved reference to 'mg_millis' and
the like; use the MicroGoose tasks instead.
Neovim, Helix and Emacs¶
The same language server works in any editor with an LSP client. The Goose
release's docs/editors.md has the setup for Neovim, Helix and Emacs; add
MicroGoose's library as the standard library. Its folder is the lib that
goose.stdlibPath names in the settings.json above. Start the server
with it:
goose lsp --stdlib /path/to/microgoose/templates/lib
For example, in Neovim, cmd = { 'goose', 'lsp', '--stdlib', '/path/to/microgoose/templates/lib' }.
To build and run, use microgoose in a terminal.