(SOLVED) Sublime Text 3 and OpenFL compilation

Hi All!

There is something wrong with sublime-plugin. When I press ctrl+shift+b it just generates new hxml file with html5 build instructions. The only way I’ve found to run project - create custom build system with lime command line.

But it is stated to work with OpenFL xml files. What could be wrong?

Try ctrl+enter
Haxe plugin for sublime uses a bit different shortcuts

thanks for reply, but ctrl+enter compiles with selected target. but i can not select the target with ctrl+shift+b. there is no dropdown. it just generates default build.hxml and opens it.

I seem to recall something where you have to open the project.xml, and set the syntax type to “NMML” in order for the plugin to handle compilation using that instead of HXML, then you use some key command to choose the target platform, I forget. It’s based on the file you’re editing being located in the same project directory, it never worked properly for me because I’m working on library code (Lime, OpenFL, Actuate, etc) so often

for me nothing happens. when i open project.xml and set its syntax to “NME Build FIle” and press ctrl+shift+b to select target, there is only message on the status bar “no hxml or nmml file found” :tired_face:

There are two sublime plugins for Haxe. Although sublime does not work for projects for me at all, it does open the compile list you’re looking for.

I installed Sublime,
the package manager,
restarted sublime,
installed haxe-sublime-bundle by clemos,
and restarted Sublime.
Then I was able to ctrl+shift+b and get all of these options.

Did you install the correct package correctly and restart sublime when instructed?

hmmm… yes, i’ve installed plugin correctly. it does highlight and autocomplete.
what file did you opened to take this screenshot? may be i open projects in wrong way?
i just open the root folder (open folder command) where project.xml is located.

upd: i’m really doing something wrong :disappointed_relieved: tried installing sublime with plugin into virtual win7. same result - plugin does not work. :tired_face:

upd2: it is written on readme, that i should open folder with hxml or nmml files inside. but there are none of them. there is only project.xml. is it the issue? i thought that this xml is the same as nmml file.

upd3: however after renaming project.xml to project.nmml nothing changed. plugin keeps saying that there is no nmml file. how it is supposed to open projects in sublime???

that’s just some .hx file after pressing ctrl+shift+b on a mac. You have a .hx file open?

The thing is: I didn’t even understand what that bit about navigating to a folder meant. So I haven’t done that, and the build options still appear. They won’t work because it’s a file that’s part of a project, but they do appear.

I read that you can open .hxml or .nmml projects with this package. I’m not sure where that leaves us project.xml people. singmajesty’s comment ^^ didn’t seem to imply it was as simple as changing the extension. But I’m not sure what he meant exactly. How do we turn it into a nmml or hxml?

just tried with sublime 2. same result. opening just single .hx file - same result.

i’ve tried what singmajesty adviced. selected syntax type for opened xml, but plugin said that there is no hxml or nmml files found. i do not understand what is wrong.

as i googled, nmml files were renamed to xml after nme was renamed to openfl, so the syntax inside is the same.

Sorry. My mistake. If I create a .hx file outside a project, ctrl shift b creates a .hxml. If I press ctrl shift b while in a .hx file that is in the Source folder of my project I get the previous list.

sorry i do not understand(

i’ve created for tests a PiratePig demo. So there is a folder in which there is project.xml and another folder with sources. i open that root folder in sublime.

and how are you opening files?

I just went file>open or dragged the .hx files in.
I just got the folders appearing on the side now. So I don’t think it was any issue.

Have you changed the project.xml file? Does it work when you create a new project with openfl create?

<?xml version="1.0" encoding="utf-8"?>
	<meta title="NameOfGame" package="com.sample.project" version="1.0.0" company="Company Name" />
	<app main="Main" path="Export" file="NameOfGame" />
	<source path="Source" />
	<haxelib name="openfl" />
	<haxelib name="actuate" />
	<assets path="Assets" rename="assets" exclude="openfl.svg" embed="true" />
	<icon path="Assets/openfl.svg" />

When I remove this file I get the js build file instead of the list of openfl export options, so I imagine if the filenames don’t match up then sublime will assume there is no build file and try to make one.

now i’ve created an empty openfl project. opening Main.hx alone results in no sidebar, so sublime knows nothing about the project. trying to select target results in generated hxml. when i open project folder, all is the same - no dropdown available.

it seems that it works only on mac :confused:

I think you are not creating Sublime’s Project properly, try clearing Workspace by closing project and/or opened files (Project -> Close Project), then start new project with “Project -> Add Folder to Project…”. Select root directory of Pirate Pig, everything should work, try Ctrl+Shift+B now.

tried it now. nothing new. i’m using sublime text 3 build 3065 and haxe-sublime-bundle version 2015. (found it inside the package-metadata). may be the reason is in versions by me here?

upd: just tried with latest version from repo. everything is the same :disappointed_relieved:

I got exactly the same versions, there is no problem for me, but Im using Linux.
Try “Goto Anything” in Sublime (Ctrl+Shift+P), try typing “haxe choose target”, can you see it? Does it show you proper key bind on the right?

i’ve tried sublime on linux, win7 and mac. typing directly in console, gives the same result as pressing key combination and combination is right.

can you please describe step by step, how do you open projects so that you can compile them in sublime? i would be greatful if it reveals what am i doing wrong.

First, create example, like:

openfl create PiratePig

Then “Add Folder to Project…” as described above - add newly created PiratePig directory. Open any .hx file in this Project with:

  • Ctrl+P, “piratepig hx”,
  • or select a file in Side Bar (Ctrl+0 for keyboard focus).

Thats it, use Ctrl+Shift+B, or Ctrl+Shift+P “haxe choose build target”.

“no hxml or nmml file found” :confounded: i give up. it is sort of curse.

upd: i’m using unregistered sublime. may be this plugin checks it? :frowning:
upd2: i’m always having in status bar “Main (js:Main.js), Line 1, Column 1” or “piratepig.PiratePig (piratepig.piratepig.js)” when i just open newly created PiratePig even before hxml for html5 is created. So it is always about js classes. Is it ok?

found the cause!! yeah! :laughing: but is very stupid.

my folder for haxe projects is named “[HAXE]”. plugin for some reason do not understands square brackets :confounded:

1 Like