HaxeFoundation / HaxeFoundation/haxe

[display] completion in build macros is a mess

Open
#8,066 10 comments 0 reactions 1 assignee Claimed by @Simn View on GitHub
bug feature-ide
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:

![](https://i.imgur.com/Z52TIaW.png)

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

![](https://i.imgur.com/2sDU1Yu.png)

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). :(

![](https://i.imgur.com/jcnng0Q.png)

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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.