-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Code action "source.addMissingImports" is extremely slow on save #208911
Comments
Please provide a small example project which demonstrates the issue |
While preparing a small example I noticed that this is caused by an icon pack I have in my project which totals over 30000 .d.ts files. Since they are in node_modules and I am definitely not editing them in-between saves, it makes me wonder if the processing that happens could be cached. The icon pack is the paid version of Font Awesome so I cannot share it publicly, I can send over a repro by email if necessary. You may also be able to reproduce the slowdown in a project with these packages in your package.json:
That's slightly under 3000 .d.ts files though, so it won't be as slow as what I'm experiencing. |
I solved my problem by re-packaging the icon pack so that all SVG icons are exported from a single file, it's now more or less instant for me. Hope this can still be improved as it's annoyingly slow when it has to check too many files. Two other issues I have with the "add missing imports" functionality:
|
This isn't a great solution, as it's a bit manual, but it works for common imports that are troublesome. Just exclude them in your |
@marksamman do you still see this happening? you should be able to cancel the save in the event of a long code action on save happening now, but this is likely caused by TS/JS |
No I haven't had this issue since I repackaged the icon library into a single file with thousands of exports instead of thousands of files with a single export per file. |
Type: Performance Issue
The issue happens when saving a ts/tsx file that has missing imports, where I expect it to add the missing imports.
It takes over 20 seconds to save when it needs to add a couple of missing imports.
Show this message in the bottom right corner:
Saving 'Filename.tsx': Getting code actions from ''TypeScript and JavaScript Language Features'' (configure).
No extensions installed. I have tried complete reinstallation of VS Code and removed all local configuration (only addMissingImports enabled).
.vscode/settings.json:
tsconfig.json:
Happens in workspace and also if I just open the particular project as a folder. I am not sure exactly when this started happening, as it has been happening from time to time, but right now happens consistently. When it was working fine it was instant.
VS Code version: Code 1.87.2 (Universal) (863d258, 2024-03-08T15:21:31.043Z)
OS version: Darwin x64 23.4.0
Modes:
System Info
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
Process Info
Workspace Info
A/B Experiments
The text was updated successfully, but these errors were encountered: