Thanks to the command-line compiler, it is possible to use an integrated development environment (IDE) for writing and compiling Mindcode. This documents has some tips on setting up the shop.
The command line tool allows you to compile your files, including the option to copy the compiled code into the clipboard automatically, or even to send it to Mindustry through the Mlog Watcher mod. The command line compiler can be set up in the following way:
- Download and install Eclipse Temurin version 17.
- Download
mindcode.jar
from the releases page and place it in a directory on your computer. - To run the command line compiler, use
java.exe -jar mindcode.jar <arguments>
. Provide full paths to thejava.exe
file from the Eclipse Temurin installation created in the first step, and to themindcode.jar
file downloaded in the second step.<arguments>
are the command line arguments passed to the Mindcode compiler.
For example, the following command compiles program.mnd
into program.mlog
, copies the resulting mlog code into the clipboard and attempts to send it directly to Mindustry (the Mlog Watcher mod must be installed for that):
java -jar mindcode.jar cm program.mnd program.mlog -c -w
For easier integration with IDEs, create a script file/batch file containing this command, using full paths to both java.exe
and mindcode.jar
, and put this file onto executable path.
Intellij IDEA can be downloaded here: https://www.jetbrains.com/idea/download/. The Community edition is free to use.
After installing and running IDEA, you can import the settings file containing Mindcode file types and external tool configurations.
- Windows: settings.zip
- Linux: settings.zip (the settings for Linux were adapted from Windows environment, but weren't tested - they may need some tweaking to work)
To import these settings, choose File/Manage IDE settings/Import settings... and select the appropriate settings file.
The settings contain Mindcode and Schemacode file type definitions configured for syntax highlighting of Mindcode and Mindustry Logic keywords. Unfortunately syntax highlighting doesn't highlight the leading @
character in Mindustry Logic built-in values and the leading $
character of formattable string literals, but otherwise is reasonably good.
Two external tools are created: Mindcode compiler
and Schemacode compiler
. You may want to assign a shortcut key to them in Settings/Keymap/External tools, and to review the command line arguments configured for either tool in Settings/Tools/External tools.
Example of syntax highlighting with the given settings:
@schittli kindly contributed a VS Code syntax highlighter.
Download the extension from the Visual Studio marketplace.
Unfortunately, the latest addition to Mindcode syntax probably aren't supported by this extension.