Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embed docs for arguments #265

Open
Aurel300 opened this issue Jan 8, 2020 · 2 comments
Open

Embed docs for arguments #265

Aurel300 opened this issue Jan 8, 2020 · 2 comments

Comments

@Aurel300
Copy link
Member

Aurel300 commented Jan 8, 2020

As discussed on Slack, I think it would be good if there was a way to "embed" the docs for the type of certain arguments visually into the docs for that method. As an example:

typedef FooOptions = {
  /**
  * something about boo
  **/
  var boo:String;

  /**
  * something about bar
  **/
  var bar:Int;
};

class Foo {
  /**
  * description of doStuff
  * @param options
  **/
  public static function doStuff(?options:FooOptions):Void;
}

Currently dox would generate a page for FooOptions and a page for Foo. To find out what the options for doStuff are, the user needs to click through FooOptions to see the description of individual options. This is reasonable for types in general, but specifically for options-like struct types like this, it is impractical – the struct type is only used for that method and nothing else.

There are multiple cases of this in the upcoming asys APIs (to avoid having a huge amount of optional arguments). A non-struct type in the current standard library is the FileSeek enum, only used in FileInput.seek.

I would suggest adding a doc "meta" like @embedParam rather than @param (or in addition to @param) that would cause dox to generate the method description as normal, but put the full type doc of the relevant type in place of the usual argument description. The result would be a single page on which the user sees the description of the method as well as its specific options or enums, without causing issues to IDE completion.

@dpeek
Copy link
Contributor

dpeek commented Jan 15, 2020

Might be better to implement a tooltip preview providing basic type information, as it solves this problem and in quite useful in general.

@Aurel300
Copy link
Member Author

I disagree with that. It may be a useful thing to remind yourself of what a particular type is at a glance. But it is not good enough to read the entire doc for the type. Consider the options type in this (old) asys function: Process.spawn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants