Skip to content

VS Code extension

The official Gram VS Code extension turns your editor into a dedicated recipe development environment. Powered by @gram-lang/language-server, it provides real-time diagnostics, advanced editing assistance, and dynamic live rendering.

  • Side-by-side rendering: As you type, the extension compiles your .gram file into HTML within a dedicated WebView panel. It uses the official Playground styles, ensuring a 1:1 match with production output. You can open it from the ▶ Preview CodeLens at the top of the file, the editor toolbar icon, or Gram: Live Preview.
  • Always-on nutrition summary: The live preview displays the recipe’s nutritional summary automatically (matching the Playground), with an energy badge in the header linking to the nutrition table at the bottom (calories, protein, carbohydrates, fat, etc.), database coverage, and notices for ingredients missing nutritional data. Running Gram: Macros from the Command Palette opens the preview and scrolls straight to this table.
  • Paused on errors: When compilation errors prevent view updates, active panels retain their last valid rendered content (dimmed under a subtle banner) rather than being wiped. A Show the error action immediately navigates to the error location in the editor, while comprehensive diagnostics appear in the Problems panel. Views automatically resume as soon as errors are resolved, preventing transient typos from blanking panels.
  • Gram: Show View...: Displays a quick-pick menu of all available outputs provided by the language server and opens the selected view in a dedicated panel: recipe presentation, operational run sheet, and developer inspectors (composed AST and compiled JSON, formatted as source text or an interactive collapsible tree). Inspectors update live as you type, offering immediate visibility into how the compiler understands your recipe.
  • Active editor synchronization: All open panels automatically track the active .gram editor tab. The language server evaluates only views that are currently visible, eliminating background compute overhead.
  • Direct shortcuts: Dedicated commands Gram: Live Preview, Gram: Run Sheet, and Gram: Macros quickly open the recipe view, the operational run sheet, and the recipe anchored directly to its nutrition summary.
  • Scale and stock: The Scale and stock section at the top of the recipe and run sheet panels adjusts this sitting, as the CLI’s --scale, --stock and --bakers-reference do: a scale in percent (200 for twice the recipe), a number of portions when the recipe states them (the scale follows), or a target quantity of one ingredient (the rest follows); the baker’s reference when gram.bakersMath is on; and the @use imports already made, whose steps then leave the plan. Its summary says what is active, and a scale that cannot be applied (an ingredient the recipe does not have, a unit that does not convert) is said there, the recipe staying at its written size. Like the serving time, these choices are shared by every panel of the recipe, kept while VS Code is open, and never saved; diagnostics, hover and inlay hints stay on the recipe as written.
  • Dedicated run sheet panel: Run Gram: Run Sheet (or click the checklist icon in the editor toolbar) to display the full schedule in a dedicated WebView independent of the live preview. It details daily kitchen presence, items to take out, tasks to perform, and background passive rests.
  • Relative countdown (D-2, D-1, Day D): Without a serving time, the schedule is presented as a relative countdown with estimated durations per day (e.g. “about 55 min”).
  • Serving time: The Served at field at the top of the panel puts the plan on the calendar, with dates, clock times and margins, in your project’s time zone and within its availability (timezone and availability in .gram/config.yaml). When to serve? proposes the times that work over the next seven days at your meal times (mealTimes), the earliest one first, and tells why the others do not; click one to use it. Clear goes back to the countdown. The serving time is kept per recipe while VS Code is open, and forgotten when you close the file or the window, so a plan is never laid out on a time already past.
  • Setting synchronization: The view adapts dynamically to the gram.miseEnPlace, gram.rests and gram.comments configuration settings (detailed below).
  • Gantt chart replacement: The legacy Gram: Gantt Chart command is deprecated since version 1.4.0 (it redirects to the run sheet with a one-time notice) and will be removed in version 2.0.0.
ValueEffect
perSection (default)Each section’s mise en place is scheduled immediately before that section.
upfrontAll mise en place tasks are scheduled at the start of the recipe.
perDayThe mise en place of each working day is scheduled at the start of that day (days derive from section day anchors, ~{-Nd}).

The setting drives the live preview, the run sheet, and the total time hint displayed next to the recipe title. It adjusts computed total and idle times without altering ingredient lists, and applies immediately to all open documents without reloading the window. See When the mise en place happens.

ValueEffect
shortest (default)A range-based passive timer (~_{12-24h}) is resolved to its minimum duration.
balancedThe passive timer is resolved to the midpoint of its range.
longestThe passive timer is resolved to its maximum duration.

Fixed passive timers and active timers with ranges (~{20-25min}, always planned using their upper bound) are unaffected. Like gram.miseEnPlace, this setting drives the live preview, the run sheet, and the total time hint, applying immediately to all open files. See Exact times and ranges.

ValueEffect
show (default)Recipe comments (// like this) appear in the preview and in the run sheet. In the run sheet, they are styled discreetly in small, muted text.
hideBoth standalone notes on their own line and end-of-line comments are omitted from both views.

This setting applies immediately to all open files (any unrecognized value defaults to show). The equivalent option is available in the CLI (--comments), the renderer API (comments), and the Playground (Display section).

SettingValuesEffect
gram.stepQuantitiesshow (default), hideControls whether ingredient quantities appear directly within step instructions, after each ingredient name, alongside standardized mass in grams: flour (250 ml, ~148 g). Section ingredient lists always display them.
gram.clock v1.5.0auto (default), 12h, 24hHow the run sheet and the serving time suggestions write the time of day: 1:00 PM or 13:00. auto uses the clock setting of the project’s .gram/config.yaml when it sets one, else the region of your system’s locale.
gram.nutritionBasisauto (default), total, perPortion, per100gCalculation basis for the nutrition panel. In auto mode, the preview shows every basis side by side (per 100 g, per portion); any other value narrows the table to that basis.
gram.bakersMathOnlyfalse (default), trueDisplays only baker’s percentages, omitting absolute weights.

Analyzer settings control which calculations are derived from the ingredient database. All are enabled by default, matching the core compiler engine. Modifying any of these settings immediately re-analyzes every open recipe and refreshes its diagnostics.

SettingEffect when enabled
gram.bakersMathComputes baker’s percentages based on the ingredient marked with *.
gram.massStandardizationStandardizes ingredient quantities into grams using database densities.
gram.yieldCalculationAccounts for preparation waste (peels, pits, trim), distinguishing gross purchasing weight from net culinary weight.
gram.nutritionEstimationComputes nutritional estimates displayed in the recipe preview.

All of these settings are available with identical values in the CLI and in the Playground. Any unrecognized value falls back to its default.

A working day pushed beyond 24 hours by a prolonged passive phase triggers an explicit warning on its section (DAY_OVERFLOW), matching compiler diagnostics.

  • Silent plural management: The extension automatically maps common plural nouns in your recipe (e.g. @carrots) to singular entries in your YAML database (carrot), maintaining natural language without raising false errors.
  • Fuzzy matching: If you misspell an ingredient, a Levenshtein distance algorithm suggests the closest known match via Code Actions (Quick Fixes).
  • Hover insights: Hover over any ingredient to inspect its nutritional profile and automatic volume-to-mass conversions (1 tbsp → 15g). Hover over a timer to see the parsed duration (~{1:30 h} → 1 h 30 min), over a section anchor to see its lead time, or over a sum/ratio to inspect its resolved value.
  • Semantic tokens: Highlighting is driven directly by the compiler AST rather than regular expressions. Modifiers, nested units, ratio operators, and composite ingredients (<@) are colored accurately according to their syntactic role.
  • Inlay hints: Displays total recipe duration at the end of the title: line (updating dynamically with gram.miseEnPlace and gram.rests) and resolved values inline after unit ratios and proportional times (= 5, = 24 min).
  • Intelligent autocomplete:
    • @ suggests ingredients declared in your database, automatically enclosing multi-word names in {} brackets.
    • & suggests available intermediate declarations (e.g. ->&dough).
    • {} contextually suggests canonical units (mass, volume) and their aliases as soon as a digit is typed; inside a timer (~{}), only time units are offered.
ShortcutCommandBehavior
F12Go to DefinitionJumps from a reference (&ref) to its original declaration (->&ref).
Shift+F12Find All ReferencesLocates every usage of a specific intermediate variable across the document.
F2Rename SymbolSafely and atomically renames an intermediate variable across the entire document.
  • Real-time validation: The language server immediately flags orphaned references, unused declarations, and scheduling conflicts.
  • Code Actions 💡:
    • Add missing title: frontmatter property.
    • Remove unused intermediate declarations.
    • Declare a missing intermediate for an orphaned reference.
    • Convert volume measurements to mass directly in code (if density is known).

Trigger document formatting (Alt+Shift+F or Shift+Option+F on macOS) to instantly normalize syntax using the 13 canonical rules:

- ##    Dough   ->&dough
- Add @lemon zest{1} < @lemon and @salt{ 15 g }.
+ ## Dough ->&dough
+ Add @lemon zest{1}<@lemon and @salt{15g}.
  • Outline view: The native VS Code Outline panel populates with a clean hierarchy of sections and intermediate variables, making large recipes easy to navigate.
  • Gutter folding: Frontmatter blocks and section bodies can be folded to maximize screen space.
  • Rich snippets: Use trigger prefixes like recipe, ##, step, @ing, or #cw to rapidly scaffold complete recipe structures.