HaxeFoundation / HaxeFoundation/haxe

[ide] object field completion for structure intersections loses the order

Open
#9,448 2 comments 0 reactions 0 assignees View on GitHub
enhancement feature-ide
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

I'm not sure how this is handled (probably just sort-by-pos.pmin?), and I'm not sure if it's even possible to fix as long as we don't have intersection types in the typed AST (we don't, right?), but it would be great if the order of suggested fields in object declaration completion was dependent on the order of types in the intersection, e.g.:

```haxe
typedef BaseProps = {
var base:Int;
}

typedef ConcreteProps = {
var concrete:Int;
}

function main() {
var props:ConcreteProps & BaseProps = {};
}
```

![image](https://user-images.githubusercontent.com/49749/82203026-02413180-9903-11ea-98a1-d21453b30c24.png)

I'd like "concrete" to show up before "base", because `ConcreteProps` comes before `BaseProps` in the type intersection (or maybe vice-versa, it doesn't matter as long as it's consistent).

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.