HaxeFoundation / haxe

Haxe - The Cross-Platform Toolkit
https://haxe.org
6.2k stars 658 forks source link

Haxe doesn't show completion for Haxe macro functions #2072

Closed as3boyan closed 11 years ago

as3boyan commented 11 years ago

I am using FlashDevelop and Haxe doesn't show completion for macro static public functions

ncannasse commented 11 years ago

Could you give a small reproducible example, using | to show the cursor position?

as3boyan commented 11 years ago

When I tried to use StablexUI, FD doesn't showed autocompletion for

UIBuilder.|

This function in UIBuilder source: macro static public function init(defaultsXmlFile:String = null, enableRTXml:Bool = false) : Expr {

Completion is'nt worked properly when Completion Mode -> Compiler(FD Program Settings -> Haxe Context)

When I set it to Completion Mode -> CompletionServer, it started to work fine. Actually Compiler setting should work almost same way, so maybe FD has some bug.

as3boyan commented 11 years ago

macro static public function init(defaultsXmlFile:String = null, enableRTXml:Bool = false) : Expr {

Haxe compiler shows this completion tip: init (defaultsXmlFile : Dynamic , enableRTXml : Dynamic ) : Dynamic

https://github.com/RealyUniqueName/StablexUI/blob/master/src/ru/stablex/ui/UIBuilder.hx#L106

Simn commented 11 years ago

That might happen because the compiler cannot be sure if you want completion in macro context or not. Looks like a fair limitation to me.

sebpatu commented 9 years ago

I don't think theres a way to ask the compiler to specifically give completion in macro context. It always give completion in non macro context, and theres no compiler option that asks the compiler to only handle macro context, so that we could get the associated completion infos.

thats an issue for IDE and completion in macro context.

we need: wether, compiler gives all completion infos, macro and non macro context wether, we have a compiler option to display macro context completion, and by default it gives (a today) non macro context completion

ncannasse commented 9 years ago

There shouldn't be any difference between compilation server and compiler mode. Please report a small reproducible example not involving any third party library if you find some.

@sebpatu compiler should be able to give completion in macro context too

sebpatu commented 9 years ago

For me its same behavior between compilation server and compiler mode. But i was able to reproduce my issue with simpe code and it shows the inconsistency:

If i get this code in one single source file: class TestMacro { public static function test0():Void {} macro public static function test1():Void {}

if macro

     public static function test2():Void {}
 #end

}

class Test {

if macro

 static function main() {
     trace("Haxe is great!");
     TestMacro.|
 }
 #end

}

Completion will correctly show me test0, test1 and test2. But if i separate the TestMacro class definition in another file, same package, completion will only gives test0, test1 and forget test2.

i do the test in flashdevelop, with not mixed completion settings. i get same result with compiler, and completion server settings.

Le 31/01/2015 00:55, Nicolas Cannasse a écrit :

There shouldn't be any difference between compilation server and compiler mode. Please report a small reproducible example not involving any third party library if you find some.

@sebpatu https://github.com/sebpatu compiler should be able to give completion in macro context too

— Reply to this email directly or view it on GitHub https://github.com/HaxeFoundation/haxe/issues/2072#issuecomment-72291295.