pylance-release
pylance-release copied to clipboard
Pylance function return type inlay hints do not work on closures
Environment data
- Pylance version: v2024.7.1
- OS and version: Windows 11
- Python version (& distribution if applicable, e.g. Anaconda): clean install of Python 3.11
Code Snippet
def simple_closure(a: int):
def doubler():
return a * 2
return doubler
Repro Steps
- configure Pylance extension in
settings.jsonwith"python.analysis.inlayHints.functionReturnTypes": true, - open a new file
- paste the code
- double click the inlay type hint
Expected behavior
The type hint should import Callable and fill in the type hint
Actual behavior
As you can see, double clicking to insert the type hint adds it as a comment. Repeatedly double-clicking keeps appending a new comment onto the end of the line.
https://github.com/user-attachments/assets/63022b26-6d37-4e6c-aa59-f2e5aff977e3
Logs
No logs to show.
thanks for the report. Looking into it.
Any updates on this?