Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Roll20 Syntax Highlight - a Visual Studio Code Extension

November 22 (3 years ago)

Edited November 22 (3 years ago)
Andreas J.
Forum Champion
Sheet Author
Translator

Roll20 Macros is an Extension for Visual Studio Code-text editor, to make roll20 macro and API command writing & troubleshooting easier. Visual Studio Code is a free text editor for Windows/Linux/Mac.

If you don't want to install VSCode, you can try out my extension right in your browser, by going to https://vscode.dev/.

Features

Bracket pairing

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

Syntax & keyword 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 replacement characters)

Examples

Macro nesting bracket highlight

Missing bracket stands out:

Install

1. Install Visual Studio Code.

2. See Gif

https://s3.amazonaws.com/files.d20.io/images/256949664/gXoe35eGoU6UWlUJg9Hi3w/original.gif?1637609460



Use

VScode shows/recognizes "rmacro"-syntax highlight when a file is saved with .roll or .rmacro suffix.

Alternatively, if you create a new file, there is a "select language"-dropdown from where you can select "Roll20 Macros" from(see gif from the Install section).

Try out in the browser

1. Go to https://vscode.dev/
2. See gif from the Install section

November 22 (3 years ago)
Andreas J.
Forum Champion
Sheet Author
Translator

(reserved for future use)

November 22 (3 years ago)

Edited November 22 (3 years ago)
vÍnce
Pro
Sheet Author

Most excellent Andreas.  Very useful foe anyone that uses VSC(it's free btw...) and does any macro creation/editing.

November 22 (3 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

I've been trying it for a couple of weeks. Very helpful!

November 22 (3 years ago)

Edited November 22 (3 years ago)
GiGs
Pro
Sheet Author
API Scripter

Nice! does it recognise javascript inside a roll20 script block in a html sheet?

It's specifically for roll20 macros?

November 22 (3 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Yeah, it makes keeping track of brackets much easier.

November 23 (3 years ago)
Andreas J.
Forum Champion
Sheet Author
Translator

GiGs said:

It's specifically for roll20 macros?

Yes. It's the reason I made it.


Might extend it to show the highlight in sheet code, and lots that could do better with highlights & autocomplete.


November 29 (3 years ago)
Andreas J.
Forum Champion
Sheet Author
Translator
  • collection of snippets added, like for default roll template, and example chat menu
  • recognize $[[ ]] as brackets
  • filetype icon added


Roll20 Sheet Dev v0.1.1 (initial release)


Also published first version of Roll20 Sheet Dev, extension to help with character sheet creation.

Doesn't have that many features yet, but have lots of options to expand.