Open janosh opened 1 year ago
@janosh Does disabling mypy
linting help?
Additionally, you could try mypy extension which uses dmypy
and does handle this in a different way so it should not block.
I had "python.linting.mypyEnabled": true
but tried setting it to false
before posting here. Makes no difference, even after window reload.
I just installed the mypy
extension as you suggested. I had to install the pre-release version since the regular gave me
Can't install release version of 'ms-python.mypy-type-checker' extension because it has no release version.
But having the extension also makes no difference.
I get this same error except it lasts indefinitely instead of 10 to 30 seconds to save a file.
Can you share your settings? Do you have Code Actions on save turned on?
@karthiknadig Yes to both:
"source.fixAll",
"source.organizeImports"
],
"editor.formatOnSave": true,
"notebook.formatOnSave.enabled": true,
I would try this first, here will ensure only ruff
is used for Organize Import action:
Another thing I would try is see if disabling fixall
stops the issue.
If the second thing improves the scenario then the issue might be in pylance
server and we can move it there.
I tried both. Quit and restarted VS Code after each change. Didn't notice any difference in the time to save. In case it helps, the repo with the longest delay is https://github.com/materialsproject/pymatgen. It's also the largest one I work on.
Not yet sure if this fixes the problem completely but when I ran Developer: Show Running Extensions
in the command palette, I found that the extension Todo Tree
was not loading and blocking. Uninstalled it and haven't had this problem since.
For me I notice that this problem is triggered if I modify and save a __init__.py
file. The log from isort then became very different. I have to restart vscode and avoid modifying __init__.py
to avoid it from happening again.
isort is the only extension on the list. I disabled Jupyter and other extensions as mentioned by others above.
Why does the __init__.py
cause such problem?
I am having this issue as well. It keeps going indefinitely. Extremely annoying.
I see this all the time too. In the Extension Host output window, there's this when it happens:
2023-10-16 09:56:38.126 [error] [ms-python.isort] provider FAILED
2023-10-16 09:56:38.127 [error] Error: AttributeError: 'NoneType' object has no attribute 'stdout'
at /home/sami/.vscode-insiders/extensions/ms-python.isort-2023.11.12711013/dist/extension.js:1:92177
at ie (/home/sami/.vscode-insiders/extensions/ms-python.isort-2023.11.12711013/dist/extension.js:1:92471)
at /home/sami/.vscode-insiders/extensions/ms-python.isort-2023.11.12711013/dist/extension.js:1:87255
at Immediate.<anonymous> (/home/sami/.vscode-insiders/extensions/ms-python.isort-2023.11.12711013/dist/extension.js:1:87275)
at processImmediate (node:internal/timers:476:21)
So without knowing anything about the code, there's a timer that runs and that fails with a Python error, and then that saving thing just fails because it waits for that timer to complete? (Perhaps there would be some way to propagate the failure?)
@sliedes Thanks for sharing the stack that helps with diagnosing this one.
it looks like some package installation failure can also cause errors like this, when i uninstalled the notebook everyting back to normal. hope this can be useful.
Follow up to https://github.com/microsoft/vscode-python/issues/19808 (which I can't comment on since locked).
I see the popup
"Getting code actions from 'Python','Jupyter', 'Ruff'"
all the time in large code bases, leading me to believe the slowness has something to do with scanning large numbers of files. The project I notice it most in has 527 Python files. It can take anywhere from 10 to 30+ seconds to save a file.I tried disabling
jupyter
andblack
formatting and the issue persists. I was seeing it long before I started usingruff
so prob not the culprit.The Python extension logs look like
mypy
is running on every save. Maybe that explains the slowness?mypy
scales poorly with project size in my experience.