-
-
Notifications
You must be signed in to change notification settings - Fork 682
Closed
Labels
Milestone
Description
ComplexType
s in parsed ASTs seem to have hidden position data, and modifying them in a particular way will result in broken position data, which prevents completions in IDE and causes wrong hover displays.
PosTest.hx
@:build(PosBuild.build())
class PosTest {
var a:Int;
function func1():Void {
var lhs_______ = 0;
var rhs_______ = 0;
lhs_______ = rhs_______;
lhs_______ = rhs_______;
lhs_______ = rhs_______;
lhs_______ = rhs_______;
lhs_______ = rhs_______;
lhs_______ = rhs_______;
lhs_______ = rhs_______;
lhs_______ = rhs_______;
}
}
PosBuild.hx
#if macro
import haxe.macro.Expr;
import haxe.macro.Context;
using haxe.macro.ComplexTypeTools;
using haxe.macro.TypeTools;
class PosBuild {
macro function build():Array<Field> {
final fields = Context.getBuildFields();
for (field in fields) {
switch field.kind {
case FVar(_, e):
field.kind = FVar(TPath({
pack: ["std"],
name: "StdTypes",
sub: "Int"
}), e);
case _:
}
}
return fields;
}
}
#end
Hovering this item is fine:
@:build(PosBuild.build())
class PosTest {
var a:Int;
function func1():Void {
var lhs_______ = 0;
var rhs_______ = 0;
lhs_______ = rhs_______;
lhs_______ = rhs_______;
lhs_______ = rhs_______;
lhs_______ = rhs_______;
lhs_______ = rhs_______;
lhs_______ = rhs_______;
lhs_______ = [rhs_______];
lhs_______ = rhs_______;
}
}
But hovering this item will result in the wrong display:
@:build(PosBuild.build())
class PosTest {
var a:Int;
function func1():Void {
var lhs_______ = 0;
var rhs_______ = 0;
lhs_______ = rhs_______;
lhs_______ = rhs_______;
lhs_______ = rhs_______;
lhs_______ = rhs_______;
lhs_______ = rhs_______;
lhs_______ = rhs_______;
lhs_______ = rhs_______;
lhs_______ = [rhs_______];
}
}