дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-03 16:51:16 +02:00
Ctrl+Shift+Space now runs **Smart Type** completion in Python files (Code › Code Completion › Smart Type, `code.smartTypeCompletion`): the lookup keeps the items whose type fits the caret's expected type, with that type in the right-hand column. basedpyright's completion items carry no type, so the candidates are resolved and their type is read from the documentation's code block. The expected type comes from the active parameter's annotation (signature help), an annotated assignment `x: T = |`, or the enclosing function's `-> T` for `return |` (also in `async def`). A member access being typed (`x: T = task.|`, `return self.|`) is skipped over to find it. Keywords and comparisons are not taken for an assignment (`else: x = |`, `ok: bool = a <= |`). An item fits when each member of its type's union fits the expected union: - types are compared in a canonical form: module prefixes dropped, `typing` aliases lowered, `Optional` / `Union` and spacing read alike (`List[Optional[int]]` is `list[int | None]`); - numbers are promoted as PEP 484 says: `float` accepts `int`, `complex` accepts both, and `bool` counts as an `int`; - a class fits as any of its bases, from the project's classes (`Dog` for `Animal`); Co-authored-by: wildcatDownstairs <[email protected]>