ChoiceScript Syntax Highlighter
[ Github | Package Control ]
Current version: 1.0.0
Compatible with Sublime 3/4. Not an IDE. Requires a copy of ChoiceScript or CSIDE to playtest your game. View the README for more information.
I decided to start using Sublime to write ChoiceScript. I immediately went to look for a syntax highlighter, and while I found one, it was not what I hoped it would be. So I decided to make my own, and Iâm happy enough with the result that I decided to share!
Features
- Custom syntax highlighting for the ChoiceScript language.
- Full support for multireplace and stat charts.
- Optional custom color scheme for enhanced syntax highlighting.
- Autocomplete commands to quickly create common lines of code (page breaks, line breaks, choices, if/else statements, stat charts, comments, etc).
- Auto-indent following appropriate lines of code (
*choice
,#options
,*if/else
,*stat_chart
). - Spell check for plain text, text for choice options, and text in multireplace.
- Word wrap automatically enabled, tabs to indent conversion enabled, auto match disabled (to keep from matching quotes).
For information on the included autocomplete commands and how to modify the syntax highlighter, its settings, or the color scheme, as well as additional screenshots and tips, view the README on Github.
Installation
đŚ Package Control (RECOMMENDED)
- In Sublime, go to Tools > Install Package ControlâŚ
- Open the Command Palette by pressing (MAC) CMD + Shift + P OR (PC) CTRL + Shift + P.
- Type
Package Control: Install Package
into the Command Palette. - In the new Package Control window, type
ChoiceScript
with no spaces. - Select âChoiceScriptâ to install the syntax and color scheme.
- On a
.txt
scene file, go to the bottom right of the Sublime window where it says âPlain Text.â Click it and select âChoiceScriptâ from the list of syntaxes. - Youâre now ready to write ChoiceScript in Sublime!
đ Manual Installation
- On the ChoiceScript Syntax repository, click âCodeâ above the files.
- Select âDownload ZIPâ and if prompted, choose where to save the folder.
- Extract the contents of the zipped folder.
- In Sublime, go to (MAC) Sublime Text > Preferences > Browse Packages⌠OR (PC) Preferences > Browse Packages⌠to open your Sublime
Packages
folder. - Copy and paste the extracted
ChoiceScript
files directly into thePackages
folder. - In Sublime, on a
.txt
scene file, go to the bottom right of the Sublime window where it says âPlain Text.â Click it and select âChoiceScriptâ from the list of syntaxes. - Youâre now ready to write ChoiceScript in Sublime!
Color Scheme
Included is an optional color scheme designed for the syntax. Since it was created for this specific syntax definition, it is able to target more specific parts of code to allow for enhanced highlighting.
It recognizes:
- Variables vs plain text in multireplace.
- Variables vs operators in
*if/*else
statements, includingand
andor
. - Variables and multireplace vs plain text in choice options.
- Image file names in
*image
and*text_image
commands. - When an
*if/else
or*selectable_if
is immediately followed by an#option
without a line break. - When a value is set to
true
vsfalse
in*create
,*temp
, and*set
. - When a
*page_break
is followed by plain text. - Commands vs variables vs plain text in
*stat_chart
.
Some of this does carry over rather well to other color schemes, but the custom color scheme was designed alongside the syntax highlighter to highlight with greater thoroughness and accuracy for ChoiceScript.
đ Using the Color Scheme
- Go to (MAC) Sublime Text > Preferences > Select Color Scheme OR (PC) Preferences > Select Color Scheme. (On Sublime 3, itâs âColor SchemeâŚâ)
- Select the âChoiceScriptâ color scheme.
- Youâre now all set with the ChoiceScript syntax highlighter and custom color scheme!
Screenshots
View the README to see screenshots of the highlighter with other color schemes.
As of right now, there are plans to include additional highlighting to support CSLIB code in the next update. If you come across any bugs or issues, please let me know and Iâll try to resolve it as soon as possible.
I hope you guys find this helpful!