# \[Solved\] Autocomplete in a macro function

**URL:** https://community.haxe.org/t/solved-autocomplete-in-a-macro-function/4310
**Category:** Haxe
**Created:** [August 9, 2024, 5:59pm UTC](https://community.haxe.org/t/solved-autocomplete-in-a-macro-function/4310 "2024-08-09T17:59:52Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![alex\_dja](https://community.haxe.org/user_avatar/community.haxe.org/alex_dja/32/294_2.png) [@alex\_dja](https://community.haxe.org/u/alex_dja)
#### Post date: [August 9, 2024, 5:59pm UTC](https://community.haxe.org/t/solved-autocomplete-in-a-macro-function/4310/1 "2024-08-09T17:59:52Z")

</div>

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

```haxe
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);
	}
}

```

---

<div class="post-metadata">

### Author: ![alex\_dja](https://community.haxe.org/user_avatar/community.haxe.org/alex_dja/32/294_2.png) [@alex\_dja](https://community.haxe.org/u/alex_dja)
#### Post date: [August 12, 2024, 3:35pm UTC](https://community.haxe.org/t/solved-autocomplete-in-a-macro-function/4310/2 "2024-08-12T15:35:52Z")

</div>

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

```haxe
...
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)
