python-lsp / pylsp-mypy

Mypy plugin for the Python LSP Server.
MIT License
118 stars 35 forks source link

Use status, kill, start, and check for dmypy #45

Closed tyoung-patreon closed 1 year ago

tyoung-patreon commented 1 year ago

Fixes usage of dmypy so only one instance is started and they don't constantly kill eachother.

Fixes #44

Richardk2n commented 1 year ago

Not calling status is something that changed some time ago with no particular reason as far as I can tell, so we can fix that.

Why call start after kill, would the next run not do that anyway?

Does this fix your issue?

tyoung-patreon commented 1 year ago

This change did fix my issues, I think run works fine as well but I definitely found it more confusing when debugging and trying to identify which process was the daemon and which was being submitted to the daemon.

The bad interaction happens in the following scenario:

  1. pylsp-mypy runs and starts a new dmypy command, it starts processing
  2. I open a new file
  3. pylsp-mypy runs and checks if dmypy is running. Instead of a successful response it just hangs
  4. pylsp-mypy kills the original process and starts a new one

This continues until I stop editing files or I wait long enough for one of the dmypy tasks to fully index. It's a pretty rough experience for my project where the initial dmypy run takes several minutes, and during that time if I edit anything it starts over entirely. When I was debugging this is was helpful to have a dmypy start command distinct from the dmypy run commands so I knew which process was which, but maybe that's just personal preference.

delfick commented 1 year ago

hello, I'm wondering if you have an idea of when you'll release a new version with this change? thanks!

Richardk2n commented 1 year ago

Now

delfick commented 1 year ago

perfect, thanks!