Header says it all. I hated writing .mcfunction files without syntax highlighting, and I couldn't find any good syntax highlighters out there, so I wrote my own
This syntax highlighter matches ALL commands in ALL forms (except for the inevitable bugs). It's pretty colorful. EVERYTHING is highlighted in such a way as to easily distinguish between the different elements of each command, including:
- individual arguments in selectors
- NBT data
- JSON text components (even highlights contained selectors)
It will also highlight some syntax errors, such as too many spaces between keywords. If your syntax is incorrect, all commands following the incorrect command may lose their highlighting. I think this is a feature that helps you find bugs in your code, so I kept it
The download is a .zip file with the following contents:
- the syntax definition file, minecraft-command-syntax.sublime-syntax
- a color scheme definition file, minecraft-command-syntax.sublime-color-scheme
- a sample function file that contains an example of basically every command possible, 1.13.1 syntax listing.mcfunction
1. Extract the contents of the download to some random folder somewhere.
2. Place the syntax definition file (minecraft-command-syntax.sublime-syntax) and the color scheme definition file (minecraft-command-syntax.sublime-color-scheme) into your C:\Users\<username>\AppData\Roaming\Sublime Text 3\Packages\User folder.
3. Select the color scheme by going to Preferences -> Color Scheme... and selecting "minecraft-command-syntax" with the subheading "User"
4. Open any file with the .mcfunction extension and see your code in a whole new light! If it doesn't work, try setting the syntax manually by going to View -> Syntax -> User -> Minecraft Command Language
- Some number syntax isn't exact. For numbers that are not allowed to be negative, technically Minecraft allows numbers like -0 and -0.0. If the number can't be negative, just don't put a - in front of it! Also leading and trailing decimal points are not allowed, e.g. ".5" or "-1.". If you're going to type a floating point number, surround the decimal point with at least a 0. It's much easier to create the syntax that way.
- I tested most of the commands in Minecraft to be sure I was getting the syntax correctly, but I am not guaranteeing it is perfect. If you find a valid command that my highlighter doesn't think is valid, post it here in this thread and I'll probably look into updating it.