The reason for this problem is probably because VS code sorts the imported packages and formats the codes first when saving the file.

You should turn off these features, then the time to save the file will be greatly reduced.

Add the following configuration to the settings.json to turn off these two functions:

    "editor.formatOnSave": false,
    "editor.codeActionsOnSave": {
        "source.organizeImports": false
    }
Answer from JialeDu on Stack Overflow
🌐
GitHub
github.com › microsoft › vscode › issues › 176896
Saving files is so slow · Issue #176896 · microsoft/vscode
March 12, 2023 - Type: Performance Issue When I finish a file and I press down "Ctrl+S", it always takes about 1 second to save the file. It is so slow, and the problem appears recently. VS Code version: ...
Author   IchinoseMeguri
🌐
Microsoft Learn
learn.microsoft.com › en-us › answers › questions › 5820928 › visual-studio-code-lag-when-saving-a-file
Visual Studio Code lag when saving a file - Microsoft Q&A
March 13, 2026 - High CPU usage during the 20+ seconds indicates an expensive operation on save. ... The Visual Studio guidance for slowness and high CPU issues also applies conceptually: a performance trace captured while the slow operation is happening makes the issue actionable. Start VS Code, prepare a minimal repro (same file and steps), then use its performance tools (Developer: Open Process Explorer / Developer tools) to record while saving.
🌐
Julia Programming Language
discourse.julialang.org › general usage
VSCode incredibly slow at saving files on windows - General Usage - Julia Programming Language
April 9, 2023 - VSCode is taking a long time to format and save files on Windows 11. I’ve configured VSCode to autoformat and save on change of mouse focus, so it is formatting and saving a lot. Format and save time is fast when VSCode is first started, a fraction of a second for files that are several thousand ...
🌐
GitHub
github.com › microsoft › vscode › issues › 204648
Slow save "getting code actions from ..." · Issue #204648 · microsoft/vscode
February 7, 2024 - Type: Performance Issue Edit and save a file (e.g., by hitting Ctrl+S). Popup showing "Saving : Getting code actions from " appears. Takes a very long time to actually save the file (more than a minute). I get this both...
Author   mbmccoy
Find elsewhere
🌐
Developer Community
developercommunity.visualstudio.com › content › problem › 1034834 › saving-files-is-slow.html
Saving files is slow - Developer Community
Skip to main content · Microsoft · Visual Studio · Sign in · You need to enable JavaScript to run this app · Sorry this browser is no longer supported · Please use any other modern browser like 'Microsoft Edge'
🌐
Developer Community
developercommunity.visualstudio.com › content › problem › 1310445 › performance-issue-when-saving-files.html
Performance issue when saving files - Developer Community
Skip to main content · Visual Studio · Guidelines Problems Suggestions Code of Conduct · Downloads · Visual Studio IDE Visual Studio Code Azure DevOps Team Foundation Server Accounts and Subscriptions · Subscriber Access · Microsoft Security Azure Dynamics 365 Microsoft 365 Microsoft ...
🌐
GitHub
github.com › microsoft › vscode › issues › 167359
VS Code takes a long time to save the file · Issue #167359 · microsoft/vscode
November 28, 2022 - We have written the needed data into your clipboard because it was too large to send. Please paste. Please see the attached snapshot for reference.
Author   hustc12
🌐
GitHub
github.com › microsoft › vscode › issues › 53292
Extremely slow saving/loading · Issue #53292 · microsoft/vscode
June 28, 2018 - VSCode Version: code --version 1.24.1 24f6262 x64 OS Version: Windows 10 Pro Steps to Reproduce: Open vscode Create a new file in terminal VSCode spins for 60+ seconds. It only seems to happen in s...
Author   ghost
🌐
GitHub
github.com › microsoft › vscode › issues › 90376
Slow Saving due to "Quick Fixes" · Issue #90376 · microsoft/vscode
February 11, 2020 - You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. ... Saving Javascript files is very slow.
🌐
VSCode.one
vscode.one › make-vscode-faster
Here's How to Make VSCode Faster
So for some reason your VSCode is slow. Really slow. How are you supposed to be productive when the program is running at snail speed? I'm going to show you how to fix this and make VS Code faster.
🌐
GitHub
github.com › microsoft › vscode-go › issues › 3063
Saving is very slow because waiting for "Quick Fixes" [flaky] · Issue #3063 · microsoft/vscode-go
February 24, 2020 - Issue Type: Bug Attempt to save a file See a window pop up "Running Save Participants... Quick Fixes" Observe: Quick Fixes doesn't complete (sometimes, this seems flaky) Can't fin...
Author   broady
🌐
GitHub
github.com › microsoft › vscode › issues › 76470
Slow file saving · Issue #76470 · microsoft/vscode
August 2, 2019 - microsoft / vscode Public · Notifications · You must be signed in to change notification settings · Fork 35.6k · Star 178k · New issueCopy link · New issueCopy link · Closed · Closed · Slow file saving#76470 · Copy link · Assignees · Labels · info-neededIssue requires more information from posterIssue requires more information from poster ·
Author   mcontim
🌐
Microsoft Learn
learn.microsoft.com › en-us › answers › questions › 2151438 › vs-code-frequently-stuck-on-saving-somefile-writin
VS Code frequently stuck on "Saving 'somefile': Writing into file... - Microsoft Q&A
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support. Download Microsoft Edge More info about Internet Explorer and Microsoft Edge ... Code will frequently get stuck on "Saving 'somefile.ext': Writing into file...". It happens often enough that it affecting my productivity. ... Most of the time the save is almost instant.
Top answer
1 of 2
3

In vscode, i tried to disable all the extensions that i installed previously, i disabled them one by one, after each disable, i test by changing the code then saving, yet the problem persists, until all the extensions are off.

Then i remembered there are some other built-in extensions. I opened the extensions, then pressed on the three dots at the top right of the left side bar, then i chose Show running extensions, the Running extensions will open and you will find among them git. I noticed that git in unresponsive and had a huge number beside it like 4000+ms which is substantially greater than all the other extensions.

Notice that i am using git version 2.34.1. Also the git extension is ok and responsive during Rust development.

So i updated git to the latest version which is 2.37.1 using these commands:

sudo add-apt-repository ppa:git-core/ppa

sudo apt update

sudo apt install git

Now i restarted vscode and the git extension is responsive and working properly. Also the saving is fast and everything in fine.

The problem was due to unresponsive git extension only in C++ development as far as i know. So update git to the latest version.

Update:

I think the problem still exists even after i updated git to the latest version. The delay still only happens with C++ development. The problem is solved once i initialized git in my working directory using git init. When i restart vscode, everything works fine. Here is a screenshot of the Running extensions when the problem exists (Notice the first git extension):

Update:

I think i knew where the problem is. The directory of my C++ project is /home/user/Projects/cpp/testing_1, in cpp/ directory i put all my C++ projects such as testing_1/, testing_2/ and so on. I initialized git in cpp/ dir before which is the parent dir of all my projects. When i deleted that .git dir in cpp/ the git extension in responsive and working fine, even when i am not initializing git in my working project such as testing_1/. I think not initializing git in the parent dir of your project solved the problem. I will see where that goes.

2 of 2
0

Not exactly a fix, but I ended up uninstalling the Microsoft C/C++ extension and installing the clangd extension. Now, not only is the formatting instant, but also the code completion suggestions and the go-to-definitions are way better and faster.

🌐
GitHub
github.com › microsoft › vscode › issues › 248752
Slow to save · Issue #248752 · microsoft/vscode
May 12, 2025 - Type: Bug Multiple people on my team are having the same issue with saving. Everytime I save, nothing happens for several seconds or mintues. I see a message in the status bar saying: "Saving [file name] Running Code Actions and fomatter...
Published   May 12, 2025
Author   joelmackenzie-lavvi
🌐
Sonar Community
community.sonarsource.com › sonarqube for ide › vs code
Large Delay in file saving - VS Code - Sonar Community
May 15, 2025 - Please provide Operating system: Windows 10 SonarQube for VS Code plugin version: 4.22.0 Programming language you’re coding in: .NET, JavaScript Is connected mode used: Yes SonarQube Cloud And a thorough description of the problem / question: On files with large numbers of errors the system takes a ridiculously long time to analyze and save the file.