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

Support for DartDoc macros #2524

Closed
goderbauer opened this issue Aug 1, 2018 · 11 comments
Closed

Support for DartDoc macros #2524

goderbauer opened this issue Aug 1, 2018 · 11 comments
Milestone

Comments

@goderbauer
Copy link
Member

When jumping to the definition of a function or property within the flutter framework I often see something like the following:

  /// {@macro flutter.widgets.widgetsApp.color}
  final Color color;

  /// {@macro flutter.widgets.widgetsApp.locale}
  final Locale locale;

It would be great if IntelliJ would offer some sort of support for these DartDoc macros. I'd love it if IntelliJ would just show inline what the macro is referencing. Or at least provide a link to the referenced location.

@pq
Copy link
Contributor

pq commented Aug 6, 2018

/cc @jcollins-g @scheglov

@pq pq added this to the Backlog milestone Aug 6, 2018
@pq pq added the enhancement label Aug 6, 2018
@scheglov
Copy link
Contributor

scheglov commented Aug 6, 2018

When you say "show inline", do you mean Quick Documentation feature of IntelliJ?
image

This should be easy to do, although very Flutter specific (not a bad thing, we love Flutter :-)). We could index all templates in FileState in unlinked summary and extend AnalysisDriver to search templates by id.

@goderbauer
Copy link
Member Author

@scheglov I did not have a specific UI in mind, but that would work. Although it might be hard to discover?

@xster
Copy link
Member

xster commented Aug 23, 2018

Or just go-to-definition clicking a @macro going to the @template would be nice too.

@dnfield
Copy link

dnfield commented Jan 24, 2019

How about if we just scanned the Flutter repo (like we do for Snippets) and generated a (JSON?) file with key/value pairs for template name and template content? Or just create a directory with a bunch of files named after their macros.

IDEs could then just access that file/files and render the content that way without re-inventing an analysis server for docs.

@jcollins-g
Copy link

Dartdoc is already loading all the macro definitions internally and could write that out as part of normal operation. It's substantially simpler than the already existing snippet support as you don't have to keep track of where things are. Maybe add a bug to dartdoc for that?

@jcollins-g
Copy link

I'm still really concerned by all of this adding to structural debt within our tools (e.g. not debt concentrated in any one tool, but part of the way we're building our tools to interact). An "analysis server for docs" may not be strictly necessary for now but I feel like we're going to want it as more and more features of Dartdoc are desired by IDEs.

@dnfield
Copy link

dnfield commented Jan 24, 2019

Yeah, after discussing further it seems like this wouldn't be a great solution.

Another thought I have is doing something like

{@macro flutter.macro.name.whatever ref=[Class.member]}

Dartdoc would ignore the ref, and IDEs could use the ref to just put See also: [Class.member]

@gspencergoog
Copy link

/cc @christopherfujino

@devoncarew
Copy link
Member

This functionality has been rolled into the analysis server - dartdoc hovers in IDEs now show the in-lined content from macros.

@hacker1024
Copy link

It would be nice to be able to ctrl+click them as well in the source code.

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

9 participants