clemos / haxe-sublime-bundle

Sublime Text bundle for Haxe programming language
Apache License 2.0
235 stars 86 forks source link

Incorrect parsing of --macro in HXML #167

Open nadako opened 9 years ago

nadako commented 9 years ago

Things like --macro addMetadata("@:nativeChildren", "unityengine.MonoBehaviour") are parsed incorrectly by the plugin (because of splitting by " "). I guess --macro needs special handling.

nadako commented 9 years ago

Actually it may make sense to do split(" ", 1) here for everything: https://github.com/clemos/haxe-sublime-bundle/blob/master/HaxeComplete.py#L822

clemos commented 9 years ago

should be fixed, please confirm ;)

nadako commented 9 years ago

Hm, it seems not to use --macro for completion and ctrl+enter builds. Also, another problem is that ctrl+enter doesn't add classes specified in hxml. For example:

build.hxml for a unity project

--macro addMetadata("@:nativeChildren", "unityengine.MonoBehaviour")
-cs out
-D dll
-D net-ver=40
-net-lib G:\Unity\Data\Managed\UnityEngine.dll
Main

ctrl+enter run: haxe -D dll -D net-ver=40 -net-lib G:\Unity\Data\Managed\UnityEngine.dll -cp F:\Code\playground --connect 6001 --cwd F:\Code\playground -cs out

completion run: haxe -D dll -D net-ver=40 -net-lib G:\Unity\Data\Managed\UnityEngine.dll -cp F:\Code\playground --connect 6001 --cwd F:\Code\playground -D st_display --display F:\Code\playground\Main.hx@95 --no-output -cs out

nadako commented 9 years ago

The --macro problem seems to be related to that it's checked as -macro, like -cmd when it should have double dash.

clemos commented 9 years ago

Ok I corrected --macro. As for the other problem, I wasn't aware you could just add Main like this. Is it documented somewhere ? How is it different from adding -main ?

nadako commented 9 years ago

--main specifies a class with the main static function. when you use it, haxe generates a call to that function. however, when you simply specify modules by their dot-path, it just compiles them, which is useful for compiling pluggable libraries. i believe it's mentioned in haxe command line help :wink:

nadako commented 9 years ago

You can try for yourself by doing haxe -main Main -js test.js vs haxe Main -js test.js and looking at the output.

clemos commented 9 years ago

Ok, I'll see if I can implement that ;)