The annotation inserted on double-click of the preview of inferred type does not match, and instead inserts the first imported variable of that type #5693
Labels
bug
Something isn't working
fixed in next version (main)
A fix has been implemented and will appear in an upcoming version
Environment data
Language Server version: 2024.3.101, also appears in 2024.3.2
OS and version: Windows 10
Python version (& distribution if applicable, e.g. Anaconda): 3.11.3
VSCode extensions enabled: Python, Python Debugger, Pylance
Code Snippet
The simplest case.
A case with multiple types.
Repro Steps
Expected behavior
The text inserted should match the type inference preview.
Actual behavior
The text inserted is the first imported variable of the type matching the inferred annotation. In my testing this happens with "int" if you use an int variable import (from sys import dllhandle). This also happens whether the variables are used in the module or not. When there are more than one imports of a type only the first is inserted as a type annotation for that type.
Logs
This is what is produced when I click ": float" and it turns into ": pi". If more would help I can try to sanitize a full log.
The text was updated successfully, but these errors were encountered: