Generated docstring should not include `:type` for unannotated parameters
Environment data
- Pylance version: 2024.9.102
- OS and version: Windows 11
- Python version: 3.9.12
Code Snippet
def foo(param1) -> int:
""""""
return 1
Repro Steps
- Trigger completion within
""""""
Expected behavior
No :type for unannotated param1.
Actual behavior
"""Docstring for foo
:param param1: Description
:type param1: """
Would this truly be good/useful behaviour? A codebase not using type-hints might still want to, and often should, document the expected type.
Thanks for posting this comment. We will hold on making this change. For other users, please upvote if you want this to be fixed.
Also noticed that it doesn't generate docstring for annotated attributes without default values, will also fix this.
class A:
"""
Docstring for A
:var b: Description
:vartype b: str
:var c: Description
:vartype c: float"""
a : int
b : str = "default"
c = 2.2
pass
This issue has been fixed in prerelease version 2025.6.100, which we've just released. You can find the changelog here: CHANGELOG.md