Skip to content

Commit 9deb0aa

Browse files
garazdawiwojtekmach
authored andcommittedDec 4, 2023
Add kind, name, arity and module to metadata used in groups_for_docs
1 parent b630899 commit 9deb0aa

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed
 

‎lib/ex_doc/retriever.ex

+27-4
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,14 @@ defmodule ExDoc.Retriever do
249249
(source_doc && doc_ast(content_type, source_doc, file: source.path, line: doc_line + 1)) ||
250250
function_data.doc_fallback.()
251251

252-
group = GroupMatcher.match_function(groups_for_docs, metadata)
252+
group =
253+
GroupMatcher.match_function(
254+
groups_for_docs,
255+
Map.merge(
256+
%{kind: type, name: name, arity: arity, module: module_data.module},
257+
metadata
258+
)
259+
)
253260

254261
%ExDoc.FunctionNode{
255262
id: nil_or_name(name, arity),
@@ -323,7 +330,15 @@ defmodule ExDoc.Retriever do
323330
doc_ast = doc_ast(content_type, source_doc, file: source.path, line: doc_line + 1)
324331

325332
metadata = Map.put(metadata, :__doc__, :callback)
326-
group = GroupMatcher.match_function(groups_for_docs, metadata)
333+
334+
group =
335+
GroupMatcher.match_function(
336+
groups_for_docs,
337+
Map.merge(
338+
%{kind: kind, name: name, arity: arity, module: module_data.module},
339+
metadata
340+
)
341+
)
327342

328343
%ExDoc.FunctionNode{
329344
id: "c:" <> nil_or_name(name, arity),
@@ -355,7 +370,7 @@ defmodule ExDoc.Retriever do
355370

356371
defp get_type(type_entry, source, groups_for_docs, module_data, annotations_for_docs) do
357372
{:docs_v1, _, _, content_type, _, module_metadata, _} = module_data.docs
358-
{{_, name, arity}, anno, _signature, source_doc, metadata} = type_entry
373+
{{kind, name, arity}, anno, _signature, source_doc, metadata} = type_entry
359374
doc_line = anno_line(anno)
360375
source = anno_file(anno, source)
361376
annotations = annotations_from_metadata(metadata, module_metadata)
@@ -369,7 +384,15 @@ defmodule ExDoc.Retriever do
369384

370385
doc_ast = doc_ast(content_type, source_doc, file: source.path, line: doc_line + 1)
371386
metadata = Map.put(metadata, :__doc__, :type)
372-
group = GroupMatcher.match_function(groups_for_docs, metadata)
387+
388+
group =
389+
GroupMatcher.match_function(
390+
groups_for_docs,
391+
Map.merge(
392+
%{kind: kind, name: name, arity: arity, module: module_data.module},
393+
metadata
394+
)
395+
)
373396

374397
%ExDoc.TypeNode{
375398
id: "t:" <> nil_or_name(name, arity),

0 commit comments

Comments
 (0)
Please sign in to comment.