haxe-sublime-bundle
haxe-sublime-bundle copied to clipboard
Autocompletion doesn't work when adding noCompletion in a build class
With Haxe 3.4, adding @:noCompletion
to a class created with a build macro prevents autocompletion.
Main.hx
@:build(Builder.build())
class Main
{
static function main() {
new Main();
}
public function new() {
this.| // "No autocompletion available"
}
public function start() {
trace("start");
}
@:noCompletion public function start2() {
trace("start2");
}
}
Builder.hx
import haxe.macro.Context;
using Lambda;
class Builder
{
public static function build() {
var fields = Context.getBuildFields();
var startField = fields.find(function(f) return f.name == "start");
// Commenting out this line makes it work:
startField.meta.push({name: ":noCompletion", params: [], pos: Context.currentPos()});
return fields;
}
}
haxe --display Main.hx@0
returns <list></list>
, so that seems to work.
Isn't this a feature :p ? In any case, I guess it should be reported to the compiler, shouldn't it ?
Yes, it seems to work, I got it confused with the same issue for Haxedevelop. But I see now that there is no autocompletion for startField
inside Builder.hx.
import haxe.macro.Context;
using Lambda;
class Builder
{
public static function build() {
var fields = Context.getBuildFields();
fields.| // autocompletion for array works fine
var startField = fields.find(function(f) return f.name == "start");
startField.meta.push({name: ":noCompletion", params: [], pos: Context.currentPos()});
startField.| // no autocompletion, no error
return fields;
}
}