Repository navigation
Tools
Tools are commands that work on a module's sources rather than build them, such as a code formatter or a linter. The plugin detects the formatter and checkstyle haxelibs from their configuration files, and you can add tools of your own. This page shows where tools appear, how to add and run them and how to run the formatter and checkstyle on a single file from the editor.
In the Haxe tool window, a module (or the project node) gets a Tools group as soon as it has at least one tool. It lists the detected tools first, then your own. Each row shows the tool's name and, in gray, the configuration file it was detected from, or the command of a tool you added.

A module with three detected tools
To run a tool, double-click it, or select it and press Enter, or right-click it and choose Run. The output appears in a console tab of the Run tool window, named after the tool; click Stop there to end it. As with builds, the IDE saves all open files first, and in a project that is not trusted you are asked to trust it first (see Core Concepts).
When a module's root folder contains one of these files, the tools appear on their own:
| File in the module's root folder | Tools | Command |
|---|---|---|
checkstyle.json |
Run checkstyle | haxelib run checkstyle -s <source folder> ... |
hxformat.json |
Format sources | haxelib run formatter -s <source folder> ... |
hxformat.json |
Check formatting | haxelib run formatter --check -s <source folder> ... |
- The tools run in the module's root folder, so they find their configuration there, as they would when you run them in a terminal in that folder.
- Every source folder of the module is passed with
-s, relative to the module's root folder. A module without source folders passes its whole root folder. - Format sources rewrites the files; Check formatting only reports the files that are not formatted.
- The
checkstyleandformatterhaxelibs must be installed. Install them like any other library, for example from the Haxelib Explorer. - haxelib is chosen as described in Which haxelib the plugin uses.
The plugin's own code formatter also reads hxformat.json. See Formatting and Code Style.
-
In the Haxe tool window, right-click the module (or the project node, its Tools group or one of its tools) and choose Add Tool….
-
Fill in the Add Tool dialog:
Field Meaning Name: The name shown in the Tools group. Command: The command line to run. Work directory: Where the command runs. It starts as ${moduleRoot}; an empty field also means the module's root folder. -
Click OK.
The command and the work directory can use these variables:
| Variable | Expands to |
|---|---|
${haxe}, ${haxelib}
|
The haxe and haxelib executables of the module's Haxe SDK. Only in the command. |
${moduleRoot} |
The module's root folder. |
${projectRoot} |
The project's root folder. |
For example, a tool that runs a Haxe script with the interpreter:
${haxe} -cp scripts --run CleanupTo change or delete a tool you added, right-click it and choose Edit Tool… or Remove Tool. Detected tools cannot be edited or removed; they disappear when their configuration file is gone.
Note
The command runs directly, not through a shell, so shell syntax such as |, > or && does not work. To use it,
call the shell yourself, for example sh -c "..." or cmd /c .... A program name without a path, such as haxe,
is looked up on the PATH; use ${haxe} or ${haxelib} for the SDK's own. On Windows, .bat and .cmd
programs on the PATH are found too.
Tool commands run in a pseudo-terminal, so when a tool asks a question, you can type the answer in the console.
Both are command lines of your own and use the same kind of dialog. They differ in what they belong to:
| Tools | Custom actions | |
|---|---|---|
| Belong to | A module | A build file |
| Shown in | The module's Tools group | The build file's Actions group |
| An empty Work directory: means | The module's root folder | The build file's working directory |
| Variables |
${haxe}, ${haxelib}, ${moduleRoot}, ${projectRoot}
|
Also ${target} and ${serverPort}
|
| Can be the module's build command | No | Yes |
| Can run other actions first | No | Yes, with Run before; an action without a command only runs those |
| Run through a run configuration | No, they run in a console | Yes, a Haxe Action configuration |
Use a custom action for anything that builds or runs your program, and a tool for everything else.
When you edit a .hx file, the editor's context menu offers a Haxe Tools submenu if an hxformat.json or
checkstyle.json is found in the file's folder or one of its parent folders, up to the project's root folder:
| Action | Needs | What it does |
|---|---|---|
| Format File | hxformat.json |
Formats this file with the formatter haxelib and reloads it in the editor. |
| Check Formatting | hxformat.json |
Checks this file's formatting without changing it. |
| Show Formatting Diff | hxformat.json |
Formats the editor's current text, including unsaved changes, and shows the result in a diff window (Current against Formatted) without changing the file. |
| Run Checkstyle | checkstyle.json |
Lints this file with the checkstyle haxelib. |
These actions run in the folder that holds the configuration file. Format File, Check Formatting and Run Checkstyle show their output in a console tab of the Run tool window. Show Formatting Diff tells you in a notification when the file is already formatted, or when formatting is disabled for it.
Tip
The plugin looks for the configuration files in the background. The first time you open the context menu in a folder, the Haxe Tools submenu can be missing; it appears the next time.
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