Did you accidentally close VS Code, leaving the files unsaved? Is it possible to recover unsaved Visual Studio Code files? The answer is positive. This post on MiniTool introduces how to recover VS Code unsaved files effectively.

Visual Studio Code (also called VS Code) is a popular code editor that is mainly used for writing and editing code in various programming languages. It supports multiple programming languages ​​and various plugins and is widely used by code programmers and developers.

Although this tool is generally stable, it may occasionally crash and cause current files to be unsaved and lost. Or, you may accidentally exit the software and forget to save your files. Faced with a similar situation, you may ask: Is there a chance to recover unsaved Visual Studio Code files? Fortunately, the answer is yes. Read on to get the methods of unsaved/deleted VS Code file recovery.

4 Ways to Recover Unsaved Final Draft Files on Windows
4 Ways to Recover Unsaved Final Draft Files on Windows

This post introduces how to recover unsaved Final Draft files on Windows 10. You can refer to the methods here to get your data back.

Read More

How to Recover Unsaved/Deleted Visual Studio Code Files

Way 1. Through VS Code Backup Files

Visual Studio Code will store the raw data for your unsaved files in a Backups folder. These files mainly contain unsaved changes during the code editing process, thus ensuring that you will not lose unsaved progress due to unexpected circumstances. You can go to the Visual Studio Code backup file location to recover unsaved files VS Code.

For Windows: C:\Users\username\AppData\Roaming\Code\Backups

Tips:
The AppData folder is hidden by default. To unhide it, go to the View tab in File Explorer, and then tick the box of Hidden items.
show the Backup folder of VS Code in File Explorer

For Linux: ~/.config/Code/Backups

For macOS: ~/Library/Application Support/Code/Backups

Way 2. With Local History: Find Entry to Restore

Local History: Find Entry to Restore is a powerful feature built into Visual Studio Code. It saves the historical versions of your code files, allowing you to restore the historical file versions when you delete or forget to save your files. Here you can see how to use this feature to restore your files with the Command Palette tool.

Step 1. Open Visual Studio Code. Then press the Ctrl + Shift + P key combination (for Windows) to access Command Palette. Alternatively, you can click the gear icon and choose Command Palette from the text menu to open it.

Step 2. In the box, type Local History: Find Entry to Restore and press Enter.

Step 3. Then you will be prompted to select the file for which you want to show local history. Just select the target one.

select the target file to show its local history in VS Code

Step 4. Select the local history entry to open based on the file editing time. Then the previous version of your file will show up.

Simple Guide: How to Use Autopsy to Recover Deleted Files
Simple Guide: How to Use Autopsy to Recover Deleted Files

Have you ever heard of Autopsy? How to use Autopsy to recover deleted files on Windows? Here is a comprehensive guide.

Read More

Way 3. From Visual Studio Code History

The History folder of Visual Studio Code also stores the historical versions of your files and file modification records. If you accidentally delete your files, you can try to retrieve them from this folder.

First, press the Windows + E key combination to open File Explorer.

Second, navigate to this location: C drive > Users > username > AppData > Roaming > Code > User > History.

Here you may see many folders, and each of those represents a file with different versions. You can open each folder and find the needed items based on file modification time.  

Way 4. Use MiniTool Power Data Recovery

If your VS Code files stored on a local disk are deleted and cannot be recovered by using the ways above, you can try using MiniTool Power Data Recovery. It is regarded as the best data recovery software for Windows due to its comprehensive and secure data recovery capabilities and easy operations. It can help recover almost all kinds of files from various file storage media.

You can download its free edition and use it to recover 1 GB of your VS Code files or other files for free.

MiniTool Power Data Recovery FreeClick to Download100%Clean & Safe

Guide to Recover Deleted Projects in Visual Studio Code: 3 Ways
Guide to Recover Deleted Projects in Visual Studio Code: 3 Ways

This post introduces three feasible solutions to recover deleted projects in Visual Studio Code in detail to you.

Read More

After recovering your files, it is necessary to take some measures to prevent file loss in the future. For example, you are recommended to keep the backup and sync feature enabled, use a version control system to track file changes, develop the habit of saving files promptly, back up files to the cloud or another disk regularly, and so on.

Bottom Line

Now you should know how to recover unsaved Visual Studio Code files. You can check the Backup or History folder or use the Local History: Find Entry to Restore feature.

  • linkedin
  • reddit