Repository navigation
Resolve Context
A project often has several build files that compile the same sources: a browser build and a Node.js build that share
src, or one Lime project per platform. The compiler sees each file as one of those builds sees it, with that
build's target, defines and libraries. The IDE does the same: it analyzes each source file under one build file, the
file's resolve context. This page explains how that build file is chosen, how you see and change it and what
follows it.
| Feature | What changes with the build file |
|---|---|
#if evaluation |
Which branches are active and which are dimmed, with the build's defines and its IDE Overrides. See Conditional Compilation. |
| Compiler-backed features | Compiler diagnostics, completion, navigation and generated members ask the compiler in that build's configuration. See Compilation Server. |
| The language level of a library file | A library or standard library file is checked with the language level of the module that contains its build file. See Core Concepts. |
| The Define flag and Undefine flag context actions | They edit the IDE Overrides of that build file, and name it, for example Define flag 'debug_overlay' for build.hxml. |
Some things do not follow it yet and use the active build file for every file: which target-specific module file is used, and which platform-specific classes completion and resolve offer. Libraries are not limited per build either: a module gets the libraries of all its build files, so code can resolve against a library only another build of the module uses. The compiler diagnostics still report such code, since the compiler sees only the file's own build.
The whole order at a glance; the list below explains each step.
flowchart TD
start(["A Haxe file"]) --> pinned("Pinned?")
pinned -->|yes| usePin["The pinned build file,<br/>while it contains the file"]
pinned -->|no| followed("Opened from<br/>another file?")
followed -->|yes| useFollowed["The build file of the file it was<br/>opened from, if that build reaches<br/>this file as closely as any other"]
followed -->|no| owned("In a class path<br/>of a build file?")
owned -->|yes| closest["The build files with the<br/>closest class-path folder"]
owned -->|no| library("In a library or the<br/>standard library?")
library -->|yes| reach["The build files that use the library;<br/>every build for the standard library"]
library -->|no| fallback["The module's default build"]
closest --> pick["If several, the first that applies:<br/>1. the build whose -main is this file<br/>2. the active build file<br/>3. the Build command's build file<br/>4. the first in the Haxe tool window"]
reach --> pick
-
The build files that contain the file. A build file contains a source file when one of its class paths is a
folder above the file:
-cpin hxml,<source>and<classpath>in Lime, OpenFL and NME files. An hxml file's own working directory counts as a class path too, as it does for the compiler. Of these, the build files with the closest folder win: atests.hxmlwith-cp testsbeats abuild.hxmlin the folder above for a file intests. -
Among equal builds, the plugin prefers, in this order:
- the build whose
-mainclass the file is (hxml files only); - the active build file;
- the build file of the Build command of the file's module;
- the first build file in the Haxe tool window.
- the build whose
- Library and standard library files sit in no build's class paths. A file of a haxelib library is reached by the builds that use the library: the builds whose selected target or section declares it, or declares a library that requires it, as the last library sync found it. The standard library, other libraries and a haxelib library no build uses are reached by every build. Among the builds that reach the file, the order of step 2 applies, so usually the active build file decides, unless the file was opened from another file.
- A file that no build file contains uses its module's default build: the active build file when that module owns it, otherwise the build file of the module's Build command.
HXP scripts that are not Lime projects are never a resolve context, because their compiler arguments come from code.
The status bar shows the resolve context of the file in the editor, for example Context: build.hxml. A build file with targets or sections adds the selected one in brackets, for example Context: project.xml [HTML5] or Context: build.hxml [JavaScript]. The widget is hidden for files that are not Haxe files and for files no build file contains. To hide it altogether, right-click the status bar and clear Haxe Resolve Context.
Hover over the widget to see why the build file was chosen:
- The build file this file is analysed under, chosen from the n builds that contain it. The plugin's own choice.
- The build file this file is analysed under, pinned. You picked it.
- The build file this file is analysed under, taken from the file it was opened from. A navigation carried it over.
When several build files contain a file, click the widget. The Resolve Context popup lists every build file that contains the file, the current one checked, each with its selected target or section.

The Context widget and its popup for a file that two project files contain
-
Pick a build file to pin the file to it. The widget shows a pin icon. The file is read again at once, so
#ifbranches and compiler diagnostics follow the new build. - Select automatically, at the end of the list while the file is pinned or carries a context from navigation, goes back to the plugin's choice.
A pin is a personal setting: it is saved in your workspace file, not shared with the project and survives restarts. It stays when you switch the active build file. It applies only while its build file still contains the file. When you rename or move the file or the build file, the pin moves with it.
When you open a file by navigating from another Haxe file, for example with Go to Declaration into a library, the opened file takes the resolve context of the file you came from, as long as that build reaches it. You then see a library class as the code that calls it is compiled: going from a Node.js program into a library that a browser build uses too keeps the Node.js build, even while the browser build is active.
- It applies only when several build files reach the opened file equally. A file with a closer build of its own keeps
it, so a Lime project's
Main.hxopened from a Node.js file stays with its Lime project. - It applies only to a newly opened editor. Navigating into a file whose tab is already open only switches to that tab, and the file keeps its context. Close the tab first, or pick the build in the Context widget (see Picking another build file).
- A pinned file keeps its pin.
- It lasts until the IDE restarts, or until you choose Select automatically. No pin icon is shown.
- Like a pin, it moves with the file and the build file when you rename or move them.
Related pages: Build Files, Targets and Sections, Conditional Compilation, Libraries and Haxelib.
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