Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix type-based code completion for some LSPs
It turns out that `picobox.Stack()` is missing few key type annotations that breaks autocompletion for some LSP servers. For instance, in the following code example: @dataclasses.dataclass class Struct: value: int @picobox.pass_("value") def pack(value: int) -> Struct: return Struct(value=value) with picobox.push(picobox.Box()) as box: box.put("value", 42) value = pack(42).value there are two broken autocompletion points: * `.put()` is not completed for the `box` variable * `.value` is not completed for the struct type returned by `pack()` This patch fixes these scenarios by (1) annotating that `picobox.push()` returns a context manager, and (2) avoiding using too-much-dynamic expressions in `picobox.pass_()` which return type cannot be easily inferred.
- Loading branch information