HaxeFoundation / HaxeFoundation/haxe
Wrong fields order for @:structInit object literal completion
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
```haxe
@:structInit
class Foo {
var b:Int;
var a:Int;
var z:Int;
var d:Int;
}
var foo:Foo = |
```
Choosing "Generate object literal" (creating an anonymous object using expected type returned by Haxe compiler) in completion there will lead to:
```haxe
var foo:Foo = {
z: z,
d: d,
b: b,
a: a
}
```
While we'd want (declaration order, which is what happens with typedefs for example):
```haxe
var foo:Foo = {
b: b,
a: a,
z: z,
d: d
}
```
Or at least (alphabetical order, which is what happens with field completion (`var foo:Foo = { | }` on `@:structInit`)):
```haxe
var foo:Foo = {
a: a,
b: b,
d: d,
z: z
}
```
Note that it also applies to:
```haxe
@:structInit
class Bar {
function new(b:Int,a:Int,z:Int,d:Int) {}
}
```
Where it seems like having declaration order instead of [currently reversed] alphabetical order would be better.
Contributor guide
Assessment
This issue has not been assessed yet.