Applying code action 'Sort imports' hangs indefinitely
See original GitHub issueEnvironment data
- VS Code version: 1.47.3
- Extension version (available under the Extensions sidebar): v2020.7.96456
- OS and version: Ubuntu 20.04
- Python version: 3.8.3 (installed by pyenv)
- Type of virtual environment used: pyenv-virtualenv
- Relevant/affected Python packages and their versions: XXX
- Relevant/affected Python-related VS Code extensions and their versions: XXX
- Value of the
python.languageServer
setting: doesn’t seem to matter; I have tried Jedi, Microsoft, Pylance, and None - isort version: 4.3.21
Expected behaviour
When I hit save on a Python file, I expect it to quickly/automatically sort my imports
Actual behaviour
It pops up a box much like this one:
Saving ‘main.py’: Applying code action ‘Sort imports’.
And that box never goes away. It hangs indefinitely. Obviously it never actually sorts my imports either, nor does it proceed to linting / auto-formatting. It just gets stuck.
Steps to reproduce:
- pip install black pylint isort autoflake
- Copy my settings.json file
- Save a Python file
Logs
Output for Python
in the Output
panel (View
→Output
, change the drop-down the upper-right of the Output
panel to Python
)
> ~/.pyenv/versions/myproject/bin/python ~/.vscode/extensions/ms-python.python-2020.7.96456/pythonFiles/pyvsc-run-isolated.py ~/.vscode/extensions/ms-python.python-2020.7.96456/pythonFiles/sortImports.py - --diff
cwd: ~/src/myproject/home
> ~/.pyenv/versions/myproject/bin/python ~/.vscode/extensions/ms-python.python-2020.7.96456/pythonFiles/pyvsc-run-isolated.py ~/.vscode/extensions/ms-python.python-2020.7.96456/pythonFiles/sortImports.py - --diff
cwd: ~/src/myproject/home
Issue Analytics
- State:
- Created 3 years ago
- Reactions:25
- Comments:53 (2 by maintainers)
Top Results From Across the Web
vscode "applying code action organize Imports" - Stack Overflow
Turns out the folder I was opening had its own custom .vscode folder with its own settings.json which had the organizeImports setting ...
Read more >Python & VS Code: make Black and organize imports ... - Reddit
Here's a short blog post on getting Black code formatting and VS Code's "organize imports on save" to play nicely together. It fixed...
Read more >Visual Studio Code | Metals - Scalameta
Click "Import build" to start the installation step. Import build. "Not now" disables this prompt for 2 minutes. "Don't show again" disables this...
Read more >Python import: Advanced Techniques and Tips
In Python, you use the import keyword to make code in one module available in another. ... You can use a package to...
Read more >Fixed issues in InDesign - Adobe Support
While applying a font via parastyle in ID and pasting it to AI, ... [Windows] InDesign intermittently crashes while working in Offline mode....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think the issue came back with version 1.56.0 of VS Code, in Windows 10. Anyone else can verified that?
I managed to workaround the problem by adding the following to settings.json (change according to your location of isort script):
“python.sortImports.path”: “${env:HOME}/.local/bin/isort”,