Skip to content

Feature request: Support type information #63

@jjlee

Description

@jjlee

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions