Support & Syntax Highlight for Roll20's macro language.
Automatic bracket pairing for roll20 syntax
- roll20 macros (
@{ }
,?{ }
,%{ }
,&{ }
,$[[ ]]
) - correctly distinguished
[[ ]]
/{{ }}
from[ [ ] ]
/{ { } }
- identifies 1st and 2nd order query nesting & HTML replacement characters
- 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](HTML replacement characters) - rmacro highlight in other languages:
- js/pug (everything inside
roll` `
will highlight) - markdown (fenced codeblocks, with
rmacro
set as language)
- js/pug (everything inside
- as you type, some matching suggestions will be provided
- also includes couple of more advanced examples
Macro nesting bracket highlight
Rmacro syntax highlight in javascript:
Rmacro syntax highlight in markdown files:
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 withrmacro
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.
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}}}
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.
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
- Regex is used for recognizing things, and creating more of them, Regexr.com is a good source.
Roll20 Sheet Dev helps with Character Sheet Development.