intellij-haxe icon indicating copy to clipboard operation
intellij-haxe copied to clipboard

Haxe4 Imports

Open WolfieWerewolf opened this issue 5 years ago • 4 comments

Hi Eric,

Just wondering how we should handle the deprecated packages with regards to the default imports when using ALT+Enter to resolve them? For example with Haxe4

js.html.Uint8Array (and the other TypedArrays) targeting JS have been moved to the js.lib package. To keep the UI from flashing at me I've been inlining the package with the Typed Array like

private var data:js.lib.DataView;

Do we need to be able to identify the haxe version from the configured SDK and then provide alternative imports? Thanks

WolfieWerewolf avatar Jul 10 '19 23:07 WolfieWerewolf

OK. I'm a bit confused by this. The libraries that are searched and appear in the list for ALT+Enter are the ones specified as libraries in the Project Configuration->Module Dependencies. That includes the Std library which is included as part of the Haxe SDK. If there are multiple libraries or packages available containing the same classes, then the project is set up incorrectly, or the SDK is referencing the wrong Std library (which is easy to do when creating a new Haxe SDK for the project).

Is it possible that you are using a 3.X SDK with and also including the hx3compat haxelib at the same time? It may be that we should attach libraries beside Std to the SDK, but we don't have that capability at the moment.

What do you mean by "to keep the UI from flashing at me"?

EricBishton avatar Jul 10 '19 23:07 EricBishton

Hi Eric, I'm sorry to be confusing. Here's a slide show.

image image image image So let me try to explain as well... The plugin expects the Uint8Array to exist in js.html but the powers that be have deprecated that and moved it to js.lib. Even if I manually modify the import statement the type is not resolved from the new location via import. Instead I have to do this. image I only have one SDK installed on this box, Haxe4 RC-3. classpath = /usr/share/haxe/std sourcepath = /usr/share/haxe/std Haxe Toolkit home path = /usr/local/bin Sorry to be confusing.

WolfieWerewolf avatar Jul 11 '19 10:07 WolfieWerewolf

Also, I only have one library configured for this project. It's an upgraded pixi-haxe which I could give you access to if you wanted. This isn't actually openfl I just borrowed some classes from openfl in a fresh project.

WolfieWerewolf avatar Jul 11 '19 10:07 WolfieWerewolf

OK. I see now. There are actually two UInt8Array types in Haxe 4.0.0-rc3. One is a typedef for the other. The build warning comes from the compiler, not the plugin, though the plugin displays it for you.

The import js.lib.UInt8Array; being shown as unused when the package is specified at the instantiation point is a known bug, but I can't find an open issue for it ATM.

The type not resolving when using the import from js.lib is not something I have seen before.

EricBishton avatar Jul 11 '19 16:07 EricBishton