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
Notes:
- 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.
This is a really great syntax highlighter, but one thing bugs me. It seems to break when you check that some nbt data does not exist, i.e. after a command similar to
execute as @e[nbt=!{tag:{Key:Value}}] run function do:something
all of the following commands are highlighted in red.
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
- a readme that echoes most of this post
Download: http://www.mediafire.com/file/4rp7188xe76a3l4/minecraft_1.13.1_syntax_highlighter.zip/file
Installation Instructions:
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
Notes:
- 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.
Example download contents:
minecraft-command-syntax.sublime-syntax
minecraft-command-syntax.sublime-color-scheme
1.13.1 syntax listing.mcfunction
This is a really great syntax highlighter, but one thing bugs me. It seems to break when you check that some nbt data does not exist, i.e. after a command similar to
all of the following commands are highlighted in red.