Skip to content

Add optional function annotations #1627

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

Merged

Conversation

maartenvanvliet
Copy link
Contributor

This PR adds the possibility to specify additional function annotations that will be rendered by ExDoc. This is at the function level what #1430 does for modules.

My use case is that a bunch of functions are generated at compile time and I want to mark them as such using @doc tags: [:generated]

This would be the result:
Screenshot 2022-11-17 at 14 08 56

@josevalim
Copy link
Member

Thanks @maartenvanvliet! Unfortunately I am a bit reserved about using :tags for this, given that tags in EDoc mean something else.

One thing we could do is to introduce a annotations_for_functions, which receives the metadata documentation and return a list. In the same way groups_for_functions and similar also handle functions.

@maartenvanvliet
Copy link
Contributor Author

I've added the annotations_for_functions config option. It's invoked with the metadata. It's not invoked for callbacks and types though, that could be added but then the function would probably need a new name :)

@josevalim
Copy link
Member

Apparently groups_for_functions is called for callbacks, so it may be a good idea to do the same here.

We can either keep it annotations_for_functions or rename it to annotations_for_entries or annotations_for_docs (given they are both declared with @doc). Any suggestions?

Then I will rename groups_for_functions later.

@josevalim
Copy link
Member

Oh, and please rebase could I made some changes to prepare the unification. :D Sorry!˜

@maartenvanvliet maartenvanvliet force-pushed the add-optional-function-annotations branch from 573b5b2 to c3a71b0 Compare November 21, 2022 09:16
@maartenvanvliet
Copy link
Contributor Author

I've gone with annotations_for_docs

@josevalim josevalim merged commit b17fcd2 into elixir-lang:main Nov 21, 2022
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

@maartenvanvliet maartenvanvliet deleted the add-optional-function-annotations branch November 21, 2022 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants