Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Support type information #63

Open
jjlee opened this issue May 16, 2023 · 1 comment
Open

Feature request: Support type information #63

jjlee opened this issue May 16, 2023 · 1 comment

Comments

@jjlee
Copy link

jjlee commented May 16, 2023

I'd like to be able to hover cursor/mouse over a variable and see mypy type information.

Could pylsp-mypy support that?

As far as I know, mypy provides two ways to access this information at present, neither of which are perfect for this purpose:

  1. dmypy supports this as of 0.981 https://mypy.readthedocs.io/en/latest/mypy_daemon.html#statically-inspect-expressions -- but I think your README.md says that dmypy only currently gives you any info on saving to disk? Better than nothing.
  2. reveal_type/reveal_locals. I guess in principle pylsp could sneak in a reveal_locals() to whatever function point is on before sending the file to mypy (obviously this has its problems!)

At present, the only other way I know of to get this information in emacs is using reveal_locals() (or reveal_type) and having flycheck show the note-level info about that that contains the types. However, this flycheck issue makes that awkward for now (and quite non-obvious that you can even see types that way!). Also of course it's annoying to have to add reveal_locals() whenever you want to see types.

@Richardk2n
Copy link
Member

Might be possible, and I am interested in implementing it.

The daemon is (as of the time I last checked) not able to shadow unsaved files. Still, using that would be the preferred way to go.

I will have a look at it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants