ty
ty copied to clipboard
Align docs/type signatures (hover) of different types/objects
Atm the documentation/type signatures on hover are a little weird/inconsistent. Pyright is very consistent here (and helpful).
Example
import os
def my_function(): ...
class MyClass:
def my_method(self): ...
my_var = my_function()
MY_CONSTANT = 0
| type | ty | pyright |
|---|---|---|
| module | <module 'os'> | (module) os |
| class | <class 'MyClass'> | (class) MyClass |
| method | def my_method(self) -> Unknown | (method) def my_method(self: Self@MyClass) -> None |
| function | def my_function() -> Unknown | (function) def my_function() -> None |
| variable | Unknown | (variable) my_var: None |
| constant | Literal[0] | (constant) MY_CONSTANT: Literal[0] |
Can you say more about what specifically you find confusing? Is it the variable type or how the information is presented?
Can you say more about what specifically you find confusing? Is it the variable type or how the information is presented?
Oh yes sure, sorry 🤓
I am talking about the presentation/wording.
Pyright
- consistent format:
(kind) info - useful information like function/method or variable/constant
ty:
- inconsistent wording
- mixing in xml like
<module 'os'>which feels out of place
Thanks, that makes sense.
I think there are multiple issues here:
- For variables, show the name of the variable rather than just the type
- Decide if we want to show the kind separately from the type