vscode: Organize Imports broken in 1.73.0
Type: Bug
After upgrading VSCode to 1.73.0, the Organize Imports action hangs indefinitely, preventing the editor from closing gracefully. If using as part of "editor.codeActionsOnSave", files can no longer be saved. Additionally, import statement in source files look glitchy, constantly flickering and changing colors from the theme’s to white. See screenshots below.
Reverting back to September’s release fixes the issue for me.
VS Code version: Code 1.73.0 (Universal) (8fa188b2b301d36553cbc9ce1b0a146ccb93351f, 2022-11-01T15:38:50.881Z) OS version: Darwin arm64 22.1.0 Modes: Sandboxed: No
System Info
| Item | Value |
|---|---|
| CPUs | Apple M1 Pro (10 x 24) |
| GPU Status | 2d_canvas: enabled canvas_oop_rasterization: disabled_off direct_rendering_display_compositor: disabled_off_ok gpu_compositing: enabled metal: disabled_off multiple_raster_threads: enabled_on opengl: enabled_on rasterization: enabled raw_draw: disabled_off_ok skia_renderer: enabled_on video_decode: enabled video_encode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: disabled_off |
| Load (avg) | 3, 4, 4 |
| Memory (System) | 32.00GB (5.22GB free) |
| Process Argv | . |
| Screen Reader | no |
| VM | 0% |
Extensions (23)
| Extension | Author (truncated) | Version |
|---|---|---|
| npm-intellisense | chr | 1.4.2 |
| path-intellisense | chr | 2.8.1 |
| vscode-markdownlint | Dav | 0.48.1 |
| vscode-eslint | dba | 2.2.6 |
| gitlens | eam | 13.0.3 |
| EditorConfig | Edi | 0.16.4 |
| prettier-vscode | esb | 9.9.0 |
| file-icons | fil | 1.0.29 |
| terraform | has | 2.24.3 |
| search-node-modules | jas | 1.3.0 |
| dotenv | mik | 1.0.1 |
| vscode-docker | ms- | 1.22.2 |
| vscode-typescript-next | ms- | 5.0.20221102 |
| vscode-groovy-lint | Nic | 2.0.0 |
| code-spell-checker | str | 2.10.1 |
| sass-indented | syl | 1.8.22 |
| sort-lines | Tyr | 1.9.1 |
| intellicode-api-usage-examples | Vis | 0.2.6 |
| vscodeintellicode | Vis | 1.2.29 |
| volar | Vue | 1.0.9 |
| vscode-typescript-vue-plugin | Vue | 1.0.9 |
| vscode-todo-highlight | way | 1.0.5 |
| better-align | wwm | 1.1.6 |
(1 theme extensions excluded)
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 56
- Comments: 29 (9 by maintainers)
Commits related to this issue
- Suppress save while applying code action save participant For #165326 With `files.refactoring.autoSave`, we can currently get into the following loop: - File saved - Code action 1 is run by `edito... — committed to mjbvz/vscode by mjbvz 2 years ago
- [#182727501] Updated Settings due microsoft/vscode#165326 - Changed setting `organizedImports` to false due bug with VSCode. - Added the plugin to organize imports on prettier (black is not configure... — committed to INGSOFT-I-PBC/AdminSite by Neoterux 2 years ago
- Set the `respectAutoSaveConfig` to false whenever applying workspace edit via code actions on save https://github.com/microsoft/vscode/issues/165326 — committed to microsoft/vscode by jrieken 2 years ago
- Remove workaround for https://github.com/microsoft/vscode/issues/165326 — committed to videomark/videomark.webdino.org by kyoshino 2 years ago
This will ship with 1.73
.1@mjbvz Even if that’s the case, this doesn’t happen on previous VSCode versions.
Due to
source.organizeImportsnot respecting trailing commas ( #98123 - unresolved), I also usesource.fixAll.eslintto fix it. However, the latest release cycles repeatedly.Thanks for the example repo @saramorillon
I believe you can work around this by setting
"files.refactoring.autoSave": false@jrieken The root cause is that autosave is being triggered during the code action’s save participant. I’ll look into suppressing this for code actions when saving
After I turned off ‘source.organizeImports’ it was fine
Perhaps this issue might have something to do with the recent changes here: #164035 ?
Same here with the
vshaxeextension. I only hadsource.organizeImportsin mycodeActionsOnSave.This regressed with https://github.com/microsoft/vscode/commit/dc04246b0ae4e05fe9a429915de75a9880e5db7b - honouring the autoSave-flag even for single file refactorings
@Zertz In my case, I have (or had before removing
"source.organizeImports"):Can confirm that this is an issue for us, also since updating to the latest VS Code version and no other changes. We also have the following settings.json, and run Prettier as part of ESLint’s
fixAllrule.That is the case in our setup, and is the expected behavior - however this bug appears even if
fixAlldoesn’t reorder the imports. The previous behavior was:organizeImportsreorders the imports, but this may not match the code style enforced by Prettier.fixAllruns Prettier, which changes the code style: in our case, adding trailing commas to all multi-line imports.This is the behavior mentioned in #98123. I consider this to be normal/expected (
organizeImportsprobably shouldn’t reformat code, only reorder the imports).However as explained by @TriStarGod this now occurs in a cycle: it seems like
organizeImportsis executed again afterfixAllwrites the fixed changes to the file, which then breaks the ESLint rule again.This is the new behavior in action:
https://user-images.githubusercontent.com/38614/200349370-7eded26f-ee00-456b-b10d-8d824ef65f78.mov
I am still experiencing this problem for
pythonfiles. What is the resolution?Version: 1.73.0 Commit: 8fa188b2b301d36553cbc9ce1b0a146ccb93351f Date: 2022-11-01T15:38:50.881Z Electron: 19.0.17 Chromium: 102.0.5005.167 Node.js: 16.14.2 V8: 10.2.154.15-electron.0 OS: Darwin x64 21.6.0 Sandboxed: No
For me it’s still glitching with this config:
I had to downgrade to make it work again.
Same issue here, infinite organize import loop with flickering of import statements. I downgraded to version 1.72.2 for now. Hopefully this can be fixed.
No, it doesn’t, but it still seems like a regression in VSCode 🤔 I’m using eslint like this person, i.e. also with
"editor.codeActionsOnSave": ["source.organizeImports", "source.fixAll.eslint"],. vscode-eslint hasn’t updated since JulyIn my case if I have an import statement like
the organize imports step will remove the trailing comma and then eslint fixAll adds it back again. But instead of doing that just once, it now happens in a continuous loop
Same for me, also using Vue (Volar) extension. Disabling organizeImports works as a temporary fix.