Skip to content

Latest commit

 

History

History
50 lines (28 loc) · 3.59 KB

TOOLS-IDE-INTEGRATION.markdown

File metadata and controls

50 lines (28 loc) · 3.59 KB

IDE Integration

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.

Setting up the command-line compiler

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:

  1. Download and install Eclipse Temurin version 17.
  2. Download mindcode.jar from the releases page and place it in a directory on your computer.
  3. To run the command line compiler, use java.exe -jar mindcode.jar <arguments>. Provide full paths to the java.exe file from the Eclipse Temurin installation created in the first step, and to the mindcode.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

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:

image

Visual Studio Code

@schittli kindly contributed a VS Code syntax highlighter.

screenshot of Visual Studio Code, with Mindcode syntax highlighting

Download the extension from the Visual Studio marketplace.

Unfortunately, the latest addition to Mindcode syntax probably aren't supported by this extension.

« Previous: Schemacode   |   Next: Command line tool »