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

Add configuration option to put status file in workspace root #50

Open
gwk opened this issue Feb 23, 2022 · 1 comment
Open

Add configuration option to put status file in workspace root #50

gwk opened this issue Feb 23, 2022 · 1 comment

Comments

@gwk
Copy link
Contributor

gwk commented Feb 23, 2022

This was briefly discussed here: #37 (comment)

The reason behind this request is that I use dmypy both as a command line type checker and within VS Code. Type checking for both would be more efficient if they can use the same daemon. I completely understand the rationale for the default (do not pollute workspace with some hidden file) but I think an option to use the dmypy default would be healthy. It promotes compatibility and encourages access to the type checker for devs who are not using VS code.

Thank you for considering this, and let me know if I can help in some way!

@matangover
Copy link
Owner

Thanks for the suggestion. I'll be happy to accept a PR if you're up for it.

Things to consider:

  1. Edge case: When two VS Code windows are open on the same folder (this is possible using workspaces), they will both use the same daemon if the proposed setting is enabled. But the daemon can only process one request at a time. This might cause some crashes or race conditions such as mypy failed with error [Errno 61]Connection Refused #37, [Errno 2] No such file or directory #45. As long as users are aware of this limitation, that's fine for me.
  2. When the proposed setting is enabled, should the extension stop the daemon when it exits? Or keep it running?

In general, I think most users should be fine with leaving the extension's dmypy instance alone. They can launch a separate instance on the command line if they want. Even for large projects the daemon is quite fast.

For now, to use the same daemon instance from VS Code and the command line, simply pass the --status-file argument to dmypy when you run it from the command line. The status file name is generated based on the worksapce id, workspace folder, and extension pid. You can see it in the Mypy output panel.

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