-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Comments
Added Area-DartDoc label. |
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. |
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 :) |
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() 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. |
Adding John Messerly for an FYI for new API app. cc @jmesserly. |
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: 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. |
@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. |
Removed the owner. |
Set owner to @jacob314. |
I seem to remember Johhni doing something related to this recently. There may be another bug that covers this. |
This comment was originally written by [email protected] Is this still an issue? If not, will be fixed after issue #8857 Added NeedsInfo label. |
It looks fixed to me: Added Fixed label. |
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.
The text was updated successfully, but these errors were encountered: