In IntelliJ IDEA, projects consist of one or more modules, which separate different parts with possibly different programming languages or libraries. A simple example would be a Wolfram package that uses Java to provide additional features through JLink. In such a setting, you usually have two different modules:

  1. A Java module that contains all the Java sources and settings to compile the code into a .jar package
  2. A Wolfram Language module that contains all the Wolfram package code

This provides a clear separation so that you can work on the Java module independently. You can set up an artifact that places the compiled Java .jar in the correct directory inside the Wolfram module so that the integration is seamlessly.

However, the Wolfram Language Plugin does not require a particular module structure, and you can edit any Wolfram Language file within your project. Additionally, not all JetBrains IDEs (like PyCharm) support a project/module structure like IDEA does.

The advantage of setting up a Wolfram module for your project is that helps the plugin to understand which Wolfram sources belong together. Also, you can add other Wolfram packages as Dependencies to enable auto-completion and code navigation. To edit the structure of your project, go to File | Project Structure…

To explain some details, the IGraphM package is used as an example.

Image

The important parts are:

  • There is a Wolfram Language module called IGraphM. Note the wolf logo in front of the name which indicates that it is indeed a Wolfram module and not a Java, Kotlin, Android, etc. module. This is important for the plugin to provide cross-file code completion and refactoring.
  • Within a Wolfram module, you can set the module language level which is used to check your code against a specific version. See the Language Version Inspection for details.
  • The IGraphM folder is marked as sources in blue, but two subfolders are excluded. This indicates where the source files of your package reside.
  • The Tests folder is marked as tests in green which is of importance to separate package code from test code.
  • In the Dependencies tab, you can set the module’s Wolfram SDK and define other Wolfram packages as external libraries. While the SDK is of no great importance in a non-compiled language like the Wolfram Language, external packages are used for code completion, highlighting and navigation.

Image

As you can see above, the IGraphM package relies on the LTemplate package. Since the plugin now knows about this dependency, it can highlight usages of LTemplate functions within the IGraphM package correctly and you can jump to their definition. Below, you see that the plugin recognizes these external usages and underlines them instead of marking them as unresolved.

Image