Skip to content

Display annotations on fields in dartdoc #1268

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
rkj opened this issue Nov 1, 2016 · 13 comments
Closed

Display annotations on fields in dartdoc #1268

rkj opened this issue Nov 1, 2016 · 13 comments
Assignees

Comments

@rkj
Copy link

rkj commented Nov 1, 2016

This can be very useful for code using framework like Angular that annotate fields with @input and @output to tell semantic of given code.

For example the just published Material widgets:
https://www.dartdocs.org/documentation/angular2_components/0.1.1/angular2_components/GlyphComponent-class.html
there is no way to tell which are actual input fields (the most important piece of API) from regular fields that are used internally by a component.

@Tomucha
Copy link

Tomucha commented Feb 22, 2017

+1, pretty please :-)

@jcollins-g
Copy link
Contributor

Surprising that this wasn't fixed with #1265 but apparently it wasn't. Looking into it.

@jcollins-g
Copy link
Contributor

In some cases, the list of annotations isn't where the dartdoc code expected it to be for certain nodes of the AST. I've figured out how to navigate the tree sufficiently to get some cases, and analyzer issue #28631 covers the rest of them, I hope.

Attached is a screenshot. Is this along the lines of what you were looking for?

screenshot from 2017-02-23 13 30 57

@keertip
Copy link
Collaborator

keertip commented Feb 23, 2017

Yes, do see the asked for info. Not sure if this is the best way to show it, but lets go with this for now.

@jcollins-g
Copy link
Contributor

https://github.com/dart-lang/dartdoc/tree/1268-display-annotations-on-field

Not usable yet as it depends on https://codereview.chromium.org/2704933002 for analyzer.

Here are a couple more screenshots showing more complex examples from Angular:

screenshot from 2017-02-24 16 37 01
screenshot from 2017-02-24 16 48 36

@devoncarew
Copy link
Member

Awesome!

We may want to render the annotations with a leading @, in order to help users know what they are when scanning the list of fields and methods.

@jcollins-g
Copy link
Contributor

Currently, other annotations have the @ intentionally stripped (protected, deprecated, etc). I don't know whether it is clearer to have them or not (I'm actually for adding the @), but I'd like to be consistent.

I will modify this to return the @ in front of all annotations unless there is a strong objection, then.

Also, this change fixes minor bugs in the prior fix for #1265 , including the appearance of spurious @ symbols in place of parameter annotations in constructor documentation.

@jcollins-g
Copy link
Contributor

Branch now has cleaned up code and tests, but waiting for analyzer 0.29 change to land and be released before mailing as a PR.

@jcollins-g
Copy link
Contributor

Obligatory screenshot, now with extra @ symbols:

screenshot from 2017-02-27 16 23 00

@devoncarew
Copy link
Member

+1 to the @ symbols :)

@keertip
Copy link
Collaborator

keertip commented Feb 28, 2017

Looks good!

@Tomucha
Copy link

Tomucha commented Feb 28, 2017

@jcollins-g since you are in this part of the dartdoc code, please have look on this:
#1162

It's very annoying and possibly dangerous. Thank you!!!

@jcollins-g
Copy link
Contributor

This refactoring of how annotations are handled will fix #1081, #1162 and issues not quite covered in the fix to #1265.

jcollins-g added a commit that referenced this issue Mar 6, 2017
This refactoring of annotations handling drops adding @s from templates in some cases, unifies code for pulling data out of analyzer, and eliminates hard to maintain and bug-causing returns in the middle of complex functions.  It fixes multiple issues, including #1081, #1268, #1162 and more.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants