Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Minimal MeTTa 2 (MM2)New to Visual Studio Code? Get it now.
Minimal MeTTa 2 (MM2)

Minimal MeTTa 2 (MM2)

Mieraf Tadesse

|
4 installs
| (1) | Free
Syntax highlighting, bracket matching, code formatting, Auto-completing, and execution support for Minimal Meta 2 (MM2)
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

MM2 Language Support

Official Language Support, Syntax Highlighter, S-Expression Formatter, IntelliSense, Snippets, Hover Documentation, File Icons, and Execution Runner for Minimal Meta 2 (MM2) and MORK.


⚡ Quick Start for formatter: How to Enable "Format on Save"

To have your MM2 files automatically indented and formatted every time you save (Ctrl + S / Cmd + S), follow either method below:

Method 1: Via VS Code Settings UI

  1. Press Ctrl + , (Linux/Windows) or Cmd + , (macOS).
  2. Search for Format On Save check the box for Editor: Format On Save.
  3. Search for Default Formatter select MM2 Language Support (mm2.mm2-syntax).

Method 2: Automatic Workspace Setup

Create or open the .vscode/settings.json file in your project root and paste:

{
  "editor.formatOnSave": true,
  "[mm2]": {
    "editor.defaultFormatter": "mm2.mm2-syntax",
    "editor.formatOnSave": true
  }
}

Method 3: Format Manually Anytime

  • Shortcut: Press Shift + Alt + F (Linux/Windows) or Shift + Option + F (macOS).
  • Command Palette: Press Ctrl + Shift + P $\to$ type Format Document.

🚀 Overview of Features

  ┌─────────────────────────────────────────────────────────────────────────┐
  │   🎨 Syntax Highlighter                                                 │
  │    Color hierarchy for Directives, Facts, Functions, Metavars, Staging  │
  ├─────────────────────────────────────────────────────────────────────────┤
  │   📁 Modern M² File Icon Theme                                          │
  │    Transparent vector M² glyphs for .mm2 and .mork in dark/light themes │
  ├─────────────────────────────────────────────────────────────────────────┤
  │   ✨ S-Expression Formatter                                             │
  │    Shift+Alt+F, Format on Save, multi-bracket pairing, comment spacing  │
  ├─────────────────────────────────────────────────────────────────────────┤
  │   💡 IntelliSense & 58+ Snippets                                        │
  │    Auto-complete + pure+<function> tab-expanding templates               │
  ├─────────────────────────────────────────────────────────────────────────┤
  │   🔍 Hover Tooltips                                                     │
  │    Live type signatures, descriptions & examples on mouse hover         │
  ├─────────────────────────────────────────────────────────────────────────┤
  │   ▶️ Cross-Platform File Runner                                         │
  │    Ctrl+F5, top-right Play icon, auto-save & auto-clear terminal        │
  └─────────────────────────────────────────────────────────────────────────┘

💡 IntelliSense & Code Snippets

Auto-Completion

Provides instant suggestions for built-in keywords, Rust primitives, pure functional templates, and math helpers. Triggered automatically as you type (, $, _, +, or letters.

Tab-Completable Snippets

Type any of the following prefixes and press Tab to expand:

1. def + Tab — Rule Definition

(DEF rule_name
    (, pattern)
    (O
        (+ (result))
    )
)

2. exec + Tab — Priority Execution Rule

(exec (0 0)
    (, pattern)
    (O
        (+ (fact))
    )
)

3. pure + Tab — Pure Evaluation

(pure (tag $out) $out
    (func (' $input))
)

4. pure+<function> + Tab — All Standard Library Function Snippets

Type pure+ or pure+<func> (e.g. pure+ge, pure+cons, pure+append) to instantly get fully-formed evaluation templates with appropriate quoting (' ...) and tab stops:

  • Comparisons (pure+ge_i32, pure+gt_i32, pure+le_i32, pure+lt_i32, pure+eq_i32, pure+ne_i32):
    (pure (tag $out) $out
        (ge_i32 (i32_from_string arg1) (i32_from_string arg2))
    )
    
  • Constructors & Substitution (pure+cons, pure+append, pure+substitute):
    (pure (tag $out) $out
        (cons (' ($head $tail)))
    )
    
    (pure (tag $out) $out
        (substitute (' ($pattern ($values))))
    )
    
  • List Transforms (pure+reverse, pure+unique-atom, pure+sort-atom, pure+length):
    (pure (tag $out) $out
        (reverse (' $list))
    )
    
  • Pattern Mining Primitives (pure+vars_to_indices, pure+indices_to_vars, pure+freshen-pattern, pure+partitions):
    (pure (tag $out) $out
        (indices_to_vars (' $list))
    )
    
  • Boolean Logic (pure+and_bool, pure+or_bool, pure+xor_bool, pure+not_bool):
    (pure (tag $out) $out
        (and_bool bool1 bool2)
    )
    

🔍 Hover Tooltips

Hovering your mouse over any of the standard library helper functions displays an instant Markdown popup with its type signature, description, parameter breakdown, and usage examples:

  • List Primitives
  • Testing & Comparisons
  • Relational Comparisons
  • Boolean Logic
  • Pattern Mining Helpers

▶️ Cross-Platform File Runner

Run any .mm2 file directly inside the integrated VS Code terminal with zero configuration.

  • Play Button (▶): Located in the top-right editor title bar.
  • Keyboard Shortcut: Ctrl + F5 (Linux/Windows) or Cmd + F5 (macOS).
  • Context Menu: Right-click anywhere in the editor $\to$ MM2: Run File in Terminal.
  • Auto-Save: Saves unpersisted changes automatically before terminal execution.
  • Auto-Clear Terminal: Clears previous outputs before each run so you always see fresh results.
  • Cross-Platform OS Support:
    • 🐧 Linux: Executes mork run "<file>" in Bash / Zsh / Fish.
    • 🍏 macOS: Executes mork run "<file>" in Zsh / Bash.
    • 🪟 Windows: Executes mork.exe run "<file>" in PowerShell / CMD / Git Bash / WSL.

⚙️ Extension Settings

Configure the extension by opening Settings (Ctrl + ,) searching for MM2:

Setting Default Description
mm2.runnerCommand "mork run \"${file}\"" Command template used to run active MM2 files. Supports ${file}, ${fileBasename}, ${fileBasenameNoExtension}, ${fileDirname}, and ${workspaceFolder}.
mm2.clearTerminalBeforeRun true Automatically clear the terminal screen before running a file.
editor.formatOnSave true Automatically format .mm2 documents on save.
editor.defaultFormatter "mm2.mm2-syntax" Set MM2 as the default formatter for .mm2 and .mork files.

Recommended Workspace Settings (.vscode/settings.json):

{
  "editor.formatOnSave": true,
  "[mm2]": {
    "editor.defaultFormatter": "mm2.mm2-syntax",
    "editor.formatOnSave": true
  },
  "mm2.runnerCommand": "mork run \"${file}\"",
  "mm2.clearTerminalBeforeRun": true
}

⌨️ Keyboard Shortcuts Reference

Shortcut (Linux / Windows) Shortcut (macOS) Action
Shift + Alt + F Shift + Option + F Format active document
Ctrl + F5 Cmd + F5 Run active MM2 file in terminal
def + Tab def + Tab Expand DEF rule snippet
exec + Tab exec + Tab Expand exec priority rule snippet
pure + function + Tab pure + function + Tab Expand pure evaluation snippet

© 2026

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft