[Solved] Autocomplete in a macro function

Hello, guys!
Is it possible to have an autocomplete ability in a macro function input expression?
For example:

class MyMacro 
{
	public static macro function process(expr: Expr): Expr
	{
                ...  
                return someExpr;
     }
}

class Main 
{
	static function main() 
	{
		final x = MyMacro.process({
			someFie| // I want autocomplete work here
		});
		trace(x);
	}
}

You should catch up EDisplay expression in the macro function and return EDisplay with expression param you want to have in autocomplete.

...
case { expr: EDisplay(e, displayKind), pos: _ }:
{
	
    final autoCompleteExpr = macro $v{ {someField: null} };
	return { expr: EDisplay(autoComlpeteExpr, displayKind), pos: Context.currentPos() }
}

It’s also possible to process different kinds of autocomplete state(displayKind param)

2 Likes