Repository navigation
Core Concepts
This page explains the ideas the rest of the plugin builds on: modules, build files, the active build file, the resolve context, targets, the per-module environment, language levels and project trust. Each section is short and links to the page that covers the topic in full.
In 2.0, your build files are the source of truth. The plugin reads them to learn what to compile, which libraries to add and which defines are set. The Haxe tool window (View | Tool Windows | Haxe) shows what it found and holds the few settings a build file cannot express.
Like any IntelliJ IDEA project, a Haxe project consists of one or more modules. A Haxe module is an ordinary module that contains Haxe code and build files; it needs no special module type.
The Haxe tool window shows the project as the top node, with one node per module below it:
- The module whose folder is the project folder is shown as the project node itself, without a module node of its own.
- Build files directly in the project folder that belong to no module also appear under the project node.
- To turn a subfolder that holds its own Haxe project into a module, click Add Module from Folder in the tool window's toolbar.
The project node and each module node have the same groups: Compilation, IDE environment and Build files, plus Tools when the module has any. See The Haxe Tool Window.
The Haxe tool window for an hxml project (left) and an OpenFL project (right)
A build file describes how to compile your code. The plugin understands these kinds:
| Kind | Files |
|---|---|
| hxml | *.hxml |
| Lime and OpenFL | project files such as project.xml or project.lime
|
| NME | *.nmml |
| HXP |
*.hxp (Beta) |
The plugin detects build files at the top level of the project folder and of each module's folder. You can add build files from other folders yourself. Under each build file, the tool window shows its Target, its Defines, its IDE Overrides, its Libraries and its Actions, the commands you can run for it. See Build Files.
Each source file is analyzed under one build file: the build that compiles it. This is the file's resolve context.
Its defines decide which #if branches are active, and compiler-backed features such as diagnostics and completion ask
the compiler in that build's configuration. The plugin picks the build file whose class paths contain the file most
closely; among equally close build files, the one whose -main class is this file wins. The Context: widget in the
status bar shows the choice, and you can pick another build file for a file there. See
Resolve Context.

The Context: widget in the status bar
One build file in the project is the active build file. The tool window shows it in bold, marked (Active).
Most files belong to one build file, and that build decides how they are analyzed (see The resolve context). The active build file decides when several build files reach a file equally, which is common:
-
A program and its tests.
build.hxml(-cp src -main Main) andtest.hxml(-cp src -cp test) both compilesrc, so a shared class such assrc/Util.hxbelongs to both equally and the active build file decides. Files intestbelong totest.hxmlalone, andsrc/Main.hxgoes tobuild.hxml, whose-mainit is. -
One code base, several targets.
build-js.hxmlandbuild-hl.hxmlwith the same-cp srccompile the same files for different targets. The active build file decides whether a shared file's#if jsor#if hlbranches are active. Two Lime or OpenFL project files that share a source folder, such as one per platform, work the same way. - Libraries and the standard library, which every build that uses them reaches.
To change it, right-click another build file and choose Set as Active Build File. When a project has exactly one build file, it becomes active on its own. To analyze a single file under another build file, pick it in the Context: widget instead.
Each module gets the libraries of all its build files, so that every file finds the libraries of its own build. They appear under External Libraries in the Project view. See Libraries and Haxelib and Conditional Compilation.
The Target row under a build file shows what the file compiles to:
-
hxml: the target is written in the file (
--hl,--js,--cpp, ...), so the row only displays it. -
Lime, OpenFL, NME and HXP project files: one file can build for many targets. Click the target in the
Target row to choose one. The choice is remembered per file and decides the target of the file's actions and
code analysis. An HXP script (an
.hxpfile that is not a Lime project) has no Target row; see Build Files. -
hxml with
--next: a file that chains several compilations gets an extra Section row. The section you pick is the one the tree, the library list and test runs follow.
See Targets and Sections.
The Compilation group of a module has three rows:
- Build command: the command that Build | Build Project and Build | Build Module run for this module, usually the default action of one of its build files. Until you set it, the module builds its default build file, marked (default). See Building and Running.
- Compilation server: whether this module's builds and compiler-backed editor features use the Haxe compilation server (Beta). Click its value to switch it on or off for the module. The server must also be enabled for the project in Settings | Build, Execution, Deployment | Build Tools | Haxe. See Compilation Server.
- Connection mode: how compiler-backed editor features reach the compiler of the module's SDK: through a compiler process of their own, for example --server-connect (host:port), or through the build's compilation server. The choice applies to every SDK of the same Haxe generation. See Where editor requests go.
The IDE environment group holds per-module settings that live in the IDE, not in your build files:
| Row | What it sets | Default |
|---|---|---|
| SDK | The Haxe SDK this module compiles and is analyzed with | The project default from Settings | Build, Execution, Deployment | Build Tools | Haxe |
| Language level | The Haxe version the editor assumes; see Language levels | The level of the module's SDK, or the project default from Settings | Build, Execution, Deployment | Compiler | Haxe Compiler when one is set there |
Click the value of the SDK or Language level row to change it. A value such as Project default (…) or From SDK (…) means the module has no setting of its own: it follows the project-wide setting or its SDK and shows the result in parentheses. See Installation.
Each build file also has IDE Overrides of its own, for code analysis only; they are never added to build commands:
- Defines to add, override or remove. Right-click IDE Overrides and choose Add Define…; Add Undefine… removes one.
- For an hxml file that selects no target, a Custom target: a
--custom-targetname that definescustom_targetandtarget.nameand activates<Module>.<name>.hxfiles.
Manage IDE Overrides… edits both in one dialog. See Defines and Custom Targets.
A language level is a Haxe version: 3.4, 4.0, 4.1, 4.2, 4.3 or 5.0. It tells the editor which language features your code may use. When code uses a feature that is newer than the module's level, the editor reports it, for example:
Null coalescing operators require Haxe 4.3 or higher (module language level is 4.2)
The quick fix Set language level to 4.3 raises the module's level.
The project default is set in Settings | Build, Execution, Deployment | Compiler | Haxe Compiler, field Default language level:. Its default is Use the SDK level of each module: each module gets the level that matches the Haxe version of its own SDK, shown as From SDK (4.3), for example. A version between two levels counts as the lower one. A module without an SDK gets the latest level, shown as No SDK (5.0). When you pick a fixed level there instead, modules without a level of their own show Project default (…). The same page has a table with a Language level for each module; the Language level row in the tool window edits the same setting.
With Use language level for conditional compilation (haxe_ver) selected (the default), #if (haxe_ver ...) blocks
are evaluated against the language level instead of the SDK's version. See
Conditional Compilation and Diagnostics and Inspections.
Building Haxe code runs code from the project: compiler macros, .hxp scripts and project-local tools. Until you
trust a project, the plugin runs none of it. You can still browse and edit the code, but Lime, OpenFL, NME and HXP
files are not evaluated, the compilation server does not start, and builds ask for trust first. See
Your First Project.
| What | Where |
|---|---|
| What to compile, libraries, defines, targets | Your build files |
| Added and hidden build files, the active build file, the IDE environment (except the language level), the IDE Overrides of each build file, build commands, the per-module Compilation server switch, custom actions and tools |
.idea/haxeBuildConfig.xml in the project |
| Build Tools | Haxe settings | .idea/haxeBuildTools.xml |
| Haxe Compiler settings, including language levels | .idea/haxeCompiler.xml |
| The selected target and section of each build file, and the build files you pinned source files to | Your personal workspace file, .idea/workspace.xml, not shared |
| Registered SDKs | The IDE, per machine |
The project stores only the names of the SDKs it uses. When you share the .idea folder, give your SDKs the same
names on every machine, or choose an SDK again after opening the project. A module SDK that is not registered on
this machine shows in red in the SDK row.
Getting started
Working with projects
- The Haxe Tool Window
- Build Files
- Targets and Sections
- Resolve Context
- Libraries and Haxelib
- Defines and Custom Targets
- Building and Running
- Run Configurations
- Tools
- Compilation Server
Debugging
Testing
Profiling
Editing code
- Code Completion
- Diagnostics and Inspections
- Refactoring and Navigation
- Formatting and Code Style
- Conditional Compilation
- Editor Extras
Reference