Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Roll20 MacrosNew to Visual Studio Code? Get it now.
Roll20 Macros

Roll20 Macros

Preview

Anduh

|
1,787 installs
| (0) | Free
Syntax support for Roll20 macros
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Roll20 Macros - rmacro

VSMarket: rmacro installs Last Commit Contributions

Twitter: @anduh_ Patreon Donate

Support & Syntax Highlight for Roll20's macro language.

  • Roll20 Macros - rmacro
    • Features
      • Bracket pairing
      • Syntax highlights
      • Snippets
    • Example
    • Use
      • Issues
    • Settings
    • Contribute
  • Related Extensions

Features

Bracket pairing

Automatic bracket pairing for roll20 syntax

  • roll20 macros (@{ }, ?{ }, %{ }, &{ }, $[[ ]])
  • correctly distinguished [[ ]]/{{ }} from [ [ ] ]/{ { } }
  • identifies 1st and 2nd order query nesting & HTML replacement characters

Syntax highlights

  • inline roll labels
  • roll, macro & API commands (e.g. /r, !example #dex)
  • normal and fate (dF) die
  • some keywords (selected, target, %%NEWLINE%%, max, cf, ceil, tracker)
  • special characters used in macros (e.g. ~,|#=+, and [HTML Entities](https://github.com/anduh/rmacro/blob/HEAD/[HTML replacement characters](https:/wiki.roll20.net/HTML_Entities))
  • rmacro highlight in other languages:
    • js/pug (everything inside roll` ` will highlight)
    • markdown (fenced codeblocks, with rmacro set as language)

Snippets

  • as you type, some matching suggestions will be provided
  • also includes couple of more advanced examples

Example

Macro nesting bracket highlight

Missing bracket stands out

Rmacro syntax highlight in javascript:

Rmacro syntax highlight in markdown files:

Use

VScode shows/recognizes "rmacro"-syntax highlight when:

  • a file has the filetype .roll (.rmacro/.roll20/.r20macro also works)
  • inside fenced codeblocks of markdown files, with rmacro set as the language.
  • inside .js and .pug-files, when the macro is inside a tagged template literal with rmacro as the tag

The autocompletions work only in .roll/.rmacro/.roll20/.r20macro-files

This extension also works on vscode.dev

You can download example.roll and the rest of the sample files) to get started.

Issues

Sometimes extra spaces are needed to keep the bracket highlight working correctly.

When nesting double- & single-bracket syntax, leave a space after the last inner character.

Good:

{{name=@{character_name} }}

Bad:

{{name=@{character_name}}}

Settings

Sets following default setting for .rmacro-files:

  • "editor.bracketPairColorization.enabled": true - If this is overruled by user settings, all bracket highlights will disappear, not just the extra coloring.
  • "editor.wordWrap": "on" - wraps lines by default. roll20 macros are often on a single line, and this improves readability.

Installs an extended version of file-icons Theme, which changes the the fileicon for .rmacro-files & some roll20 Sheet/API development-related filenames.

Contribute

repo: Anduh/rmacro

You can help even without knowing how VS Code extensions work. Here are a few concrete parts to start from:

  • More rmacro Snippets: if you look at the existing snippets for rmacro, you can follow the same patterns and expand the collection of snippets easily.
    • About:VS Code Snippet Syntax
  • improve rmacro syntax highlight:
    • Regex is used for recognizing things, and creating more of them, Regexr.com is a good source.
      • example:
    • TextMate grammar is used for defining
    • About:VSCode Syntax Highlight

Related Extensions

Roll20 Sheet Dev helps with Character Sheet Development.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft