Skip to content

Conversation

@garazdawi
Copy link
Contributor

This PR adds equiv handling for types and callbacks to the Erlang mode by adding doc_fallback support to the retriever for types and callbacks.

Also sneaking in a doc fix to describe keys available in metadata in groups_for_* functions.

Comment on lines 345 to 346
(source_doc && doc_ast(content_type, source_doc, file: doc_file, line: doc_line + 1)) ||
(callback_data[:doc_fallback] && callback_data.doc_fallback.())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies in case I am missing something obvious, but can source_doc ever be nil? However, even if nil, doc_ast would return nil anyway, so I think we can skip the source_doc && bit. I would also add a small function, doc_fallback(callback_data) for the second part, so we end-up wit this:

Suggested change
(source_doc && doc_ast(content_type, source_doc, file: doc_file, line: doc_line + 1)) ||
(callback_data[:doc_fallback] && callback_data.doc_fallback.())
doc_ast(content_type, source_doc, file: doc_file, line: doc_line + 1) ||
doc_fallback(callback_data)

WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies in case I am missing something obvious, but can source_doc ever be nil?

I was just doing the same thing as for function_data, might very well be that source_doc cannot be nil.

Refactor pushed.

@josevalim josevalim merged commit 448064e into elixir-lang:main Mar 4, 2024
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

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.

2 participants