Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/sphinx_autodoc_typehints/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,8 @@ def get_insert_index(app: Sphinx, lines: list[str]) -> InsertIndexInfo | None:
continue
line_no = node_line_no(child)
at = max(line_no - 2, 0) if line_no else len(lines)
if lines[at - 1]: # skip if something on this line
break
return InsertIndexInfo(insert_index=at, found_directive=True)

# 5. Otherwise, insert at end
Expand Down
8 changes: 6 additions & 2 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -1397,15 +1397,19 @@ def docstring_with_multiline_note_after_params_epilog_replace(param: int) -> Non
"""
mod.docstring_with_see_also()

Return type:
"str"
Test

See also: more info at <https://example.com>`_.

Return type:
"str"

"""
)
def docstring_with_see_also() -> str:
"""
Test

.. seealso:: more info at <https://example.com>`_.
"""
return ""
Expand Down