HaxeFoundation / HaxeFoundation/haxe
[display] completion in build macros is a mess
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
There seem to be quite a few issues with completion in build macros:
```haxe
// #if macro
import haxe.macro.Context;
import haxe.macro.Expr.Field;
class Macro {
static function build():Array {
var fields = Context.getBuildFields();
fields.|
return fields;
}
}
// #end
```
When attempting completion here, Haxe returns no results:

Hm, ok, maybe it doesn't know about `getBuildFields()` because we're not in macro context, let's try `#if macro`:

Wat, now I get keywords...
Well, ok, let's get rid of `#if macro` and try not to rely on type inference by adding `:Array`... Huh, that actually works! But somehow diagnostics now isn't happy anymore (this is actually why I tried `#if macro` in the first place). :(

Oh, and that diagnostic also doesn't seem to show up consistently, _sometimes_ I have to switch to another tab like `Main.hx` and back for it to show up...
At least the second issue with keyword completion showing up with `#if macro` is a regression compared to preview 4.
Contributor guide
Assessment
This issue has not been assessed yet.