Skip to content

Documentation for properties is painfully verbose #1509

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

Closed
jacob314 opened this issue Feb 3, 2012 · 15 comments
Closed

Documentation for properties is painfully verbose #1509

jacob314 opened this issue Feb 3, 2012 · 15 comments
Assignees
Labels
P1 A high priority bug; for example, a single project is unusable or has many test failures
Milestone

Comments

@jacob314
Copy link
Member

jacob314 commented Feb 3, 2012

Documentation for properties is painfully verbose
As Dart already allows fields and properties to be used interchangeably in interfaces and classes, we should always represent properties as fields where practical in the DartDoc. This issue is high priority because documentation for all properties is shown twice for all properties with documentation from MDN making the docs much harder to read.

For example:

http://api.dartlang.org/html/Element.html

String get contentEditable()
Gets/sets whether or not the element is editable.
from MDN

void set contentEditable(String value)
Gets/sets whether or not the element is editable.
from MDN

The documentation should instead read:

String contentEditable
Gets/sets whether or not the element is editable.
from MDN

For read only fields the documentation should read:

final String tagName;
The name of the tag for the given element.

Instead of
String get tagName()
The name of the tag for the given element.

For the very rare cases where getters and setters have different types we can fall back to the existing documentation style.
If the getter and setter have different documentation (never occurs for HTML) we can either display the documentation for the getter followed by the setter in the same block or fall back to the existing style of listing the getter and setter separately.

@anders-sandholm
Copy link
Contributor

Added Area-DartDoc label.

@munificent
Copy link
Member

Because of Dart's syntax for getters and setters, this is actually hard to do well, but we may be able to work around that with some heuristics and conventions.


Added this to the M1 milestone.

@munificent
Copy link
Member

Issue #2798 has been merged into this issue.


cc @sethladd.

@jmesserly
Copy link

FWIW: I generally have been only documenting one of the getter/setter pair (usually the getter), and assuming that DartDoc will eventually do something smart here :)

@DartBot
Copy link

DartBot commented Aug 21, 2012

This comment was originally written by [email protected]


I'm looking at (http://api.dartlang.org/docs/continuous/dart_io/Process.html), and the documentation for a getter looks like:

    OutputStream stdin()
    Returns an output stream to the process stdin.

    Throws an UnsupportedOperationException if the process is non-interactive.

stdin() looks like a method, not a getter. In fact, I didn't believe it actually was a getter until I saw the code.

@sethladd
Copy link
Contributor

Adding John Messerly for an FYI for new API app.


cc @jmesserly.

@DartBot
Copy link

DartBot commented Sep 11, 2012

This comment was originally written by [email protected]


Looks like the HTML library has worked around this by exposing the getter/setter pair as a field on the interface, e.g. Element.dartdoc:
  /** @­domName HTMLElement.contentEditable */
  String contentEditable;

JJ, I think you're reporting a different issue where getters were apparently just being documented wrong? Current rendering is "OutputStream get stdin()" -- clear enough that this is a getter?

I would still like if dartdoc did some clever magic itself to render getters/setters as fields, but I think the current state will get us past M1. Bumping to M2, please pull it back if you object.


Removed this from the M1 milestone.
Added this to the M2 milestone.

@jmesserly
Copy link

@eub: there was a bug that was preventing "get" from being displayed, looks like it has been fixed.

But we still need to display these as fields. The syntax for using properties does not match the documentation, and this has come up repeatedly as a cause of user confusion in hackathons and new user studies.

@munificent
Copy link
Member

Removed the owner.

@dgrove
Copy link
Contributor

dgrove commented Oct 18, 2012

Set owner to @jacob314.

@munificent
Copy link
Member

I seem to remember Johhni doing something related to this recently. There may be another bug that covers this.

@dgrove
Copy link
Contributor

dgrove commented Dec 21, 2012

Removed this from the M2 milestone.
Added this to the M3 milestone.

@anders-sandholm
Copy link
Contributor

Removed this from the M3 milestone.
Added this to the M4 milestone.

@DartBot
Copy link

DartBot commented Feb 28, 2013

This comment was originally written by [email protected]


Is this still an issue?

If not, will be fixed after issue #8857


Added NeedsInfo label.
Marked this as being blocked by #8857.

@jmesserly
Copy link

@jacob314 jacob314 added Type-Defect P1 A high priority bug; for example, a single project is unusable or has many test failures labels Feb 28, 2013
@jacob314 jacob314 self-assigned this Feb 28, 2013
@jacob314 jacob314 added this to the M4 milestone Feb 28, 2013
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 A high priority bug; for example, a single project is unusable or has many test failures
Projects
None yet
Development

No branches or pull requests

7 participants