Editor support

The StewBeet extension for VSCode is editor support for the whole beet ecosystem: beet, bolt, mecha and StewBeet. .bolt files get their own language, and the mcfunction strings inside your Python get highlighting, completion, errors and links to the built datapack.

Install: search StewBeet in the Extensions panel, or open it on the marketplace.
Needs your venv: no. It reads your sources and the files your build writes, nothing else.
Source Code: extension/vscode

You writeYou get
.bolt modulesThe Bolt language: highlighting, completion and ctrl+click on the commands, and a lens per function the module writes
bolt inside a .mcfunctionThe same, and Spyglass taken off a file it cannot parse
plain beet, ctx.data.functions[p] = Function(...)The commands inside are commands: coloured, completed, checked, and linked to what the build wrote
mechaNavigation from every generated line back to the source line it came from
StewBeet write_* helpersAll of the above, plus every {...} path resolved to what it really is

Setup

  1. Install Spyglass. It provides the completion, hover and errors the extension routes into your blocks.
  2. For navigation to the build, add the source_maps plugin to your beet.yml:
yaml
require:
    - "stewbeet"
    - "stewbeet.plugins.source_maps"    # writes the .mcfunction.map files the editor navigates with

That is the whole setup. The extension works without step 2, minus the links between your Python and the built pack.

Bolt

.bolt files open as Bolt, with a grammar generated from mecha's command tree: item = 3 is Python, item modify entity @s ... is a command.

  • Completion, errors and ctrl+click on the commands, through Spyglass. Python expressions are masked.
  • A lens per function the module writes, leading to the generated file.
  • Computed paths stay clickable: function gui.open resolves to what the last build wrote.

A .mcfunction holding bolt gets the bolt language id too. Spyglass still indexes it, so the functions it defines are known to the files that call them, and the errors Spyglass reports on its bolt lines are dropped.

See Approach 4: Bolt for the language itself.

beet

Plugins using beet's own API need nothing beyond stewbeet.plugins.source_maps:

  • Errors as you type, no build needed. Build errors are relayed onto the Python that wrote the command.
  • Navigation both ways: go to definition lands on the call that wrote a function, find references lists every writer, and a lens above each block opens what it generated.

StewBeet

python
write_function(f"{ns}:machines/tick", f"""
execute unless score @s energy.storage >= @s {ns}.energy_rate run return fail
execute if entity @s[tag={ns}.turbine] run function {ns}:turbine/tick
""")

Each {...} is filled with what the last build resolved it to, so ctrl+click and completion work on computed paths. A name resolved on one line is reused where the build covers nothing, such as commands collected in a list. Nothing evaluates your Python, and what stays unknown keeps a _ mask.

What counts as a block

Written asExample
write_* helperswrite_function, write_versioned_function, write_load_file, ...
A variablecontent = f"""...""", every += up to the call that consumes it, and a literal the call adds to it
A list.append, += [...], literals, comprehensions, "\n".join(lines)
Your own functionAny parameter annotated McFunction
beet's own APIFunction(...) from a string or a list[str], plus .append, .prepend and .lines

Highlighting a variable needs the McFunction annotation (a plain str alias from stewbeet). Everything else works without it.

Commands

From the palette: Go to Generated Function, Go to Python Source, Reload Source Maps, Refresh Build Diagnostics, Show Diagnostics Status, Install Spyglass Language Server.

Settings

All under StewBeet.*:

SettingDefault
languageFeaturestrueCompletion, hover, signature help and go to definition inside the blocks
suggestSpyglasstrueOffer the Spyglass install once, when it is missing
buildOutput""Where the generated pack is, absolute or relative to the workspace. Empty searches the workspace
sourceMapDiagnosticstrueRelay build errors onto the Python that wrote the command
resolveInterpolationstrueFill each {...} with what the last build resolved it to
diagnosticRuleDenylist["undeclaredSymbol"]Rules never relayed onto Python
codeLenstrueThe link above a block that produced a function
headerLinkstrueResource locations in a generated file's #> header
boltInMcfunctiontrueGive a .mcfunction holding bolt the bolt language id
enableBlockDecorationstrueThe coloured box around a block
backgroundColorrgba(80,40,0,0.15)Any CSS colour
borderColorrgba(200,120,30,0.30)Any CSS colour
borderWidth"2px"

Coming from Aegis

Compared to Aegis, StewBeet is lighter and easier to install, but it does not provide Python symbols in completion yet.

AegisStewBeet
.bolt highlightingNone, read as mcfunctionBolt grammar
Commands in Python stringsNoYes
Source to build navigationNoBoth directions
Needsms-python.python and your environmentNothing
.bolt completionFull compiler, Python symbols includedCommands only, through Spyglass

Keep Aegis if you need that last row.

Next steps