HaxeFoundation / HaxeFoundation/haxe

haxe.macro.Field.doc only recognizes /** doc */, no /// doc

Open
#8,164 6 comments 6 reactions 0 assignees View on GitHub
documentation
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

As of Apr 12 build,
```haxe
@:keep @:build(Macro.build())
class Test {
/// one!
static function one() {}
/** two */
static function two() {}

static function main() {
trace("Haxe is great!");
}
}
```
```haxe
//use this for macros or other classes
import haxe.macro.Expr;
import haxe.macro.Context;

class Macro {
public static function build() {
var fields = Context.getBuildFields();
for (field in fields) Context.warning("" + field.doc, field.pos);
return null;
}
}
```
gets you
```
Test.hx:4: characters 3-27 : Warning : null
Test.hx:6: characters 3-27 : Warning : two
```
It'd be lovely if `///` was also allowed for docs, as it is convenient to pull out docs into a quick reference page through a macro, but not so much when you get to choose between odd-looking
```haxe
/** Queued up input states (for local slots, size matches input delay) */
public static var states:Vector>;
```
and bulkier (3 lines of code for 1 line of text)
```haxe
/**
Queued up input states (for local slots, size matches input delay)
**/
public static var states:Vector>;
```

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.