0

I did 7-8 Ctrl+Z mistaken in explorer panel in VS Code and some files have been changed now. And it seems Ctrl+Y doesn't work in explorer to bring everything back again!

I wanted to make sure if there is anyway that I can do the opposite of those Ctrl+Zs I did in explorer?

PS: The reason I did those Ctrl+Zs was because I changed name a variable using Ctrl+Shift+H and thought by doing Ctrl+Z in explorer I can undo those name replacements but it seems I have lost a lot of codes and files!!

Hasani
  • 3,543
  • 14
  • 65
  • 125

2 Answers2

1

You can use redo command: Ctrl+Shift+Z. (command+Shift+Z on macOS)

Keyboards shortcuts is customisable in VS Code.

  • Go to File > Preferences > Keyboard Shortcuts. (Code > Preferences > Keyboard Shortcuts on macOS)

  • Search for Redo in search bar.

You can find the shortcut there. Or change it if you want.

If you have used Replace all (Ctrl + Shift + H), you may need to open individual files.

P.S. You may not be able to revert if:

  • It only works if you have not closed your VS code. Once you close it, you cannot revert.
  • If you have not made any changes after Undo. Any change you make after undo you will be the latest and override your previous modifications.

I would suggest to try testing these in a new file and then apply your findings.

subodhkalika
  • 1,964
  • 1
  • 9
  • 15
  • It seems I have that shortcut available by default but it can not redo what happened in the project. When I select the explorer and try the mentioned shortcut, nothing happens – Hasani Jun 09 '23 at 06:18
  • In the explorer I see some files with their previous names and some files with their previous code inside of them that I can not bring back the latest codes or latest file names in explorer by your suggested shortcut. – Hasani Jun 09 '23 at 06:19
  • This can only work if you have not made any changes after Undo. Any change you make after undo you will be the latest and override your previous modifications. So, no going back. – subodhkalika Jun 09 '23 at 06:19
1

Unsaved files can be stored temporarily. Have you tried checking the following directories?

Windows User

 C:\Users\USERNAME\AppData\Roaming\Code\User\History
 C:\Users\USERNAME\AppData\Roaming\Code\

For Linux users they are found at

 ~/.config/Code/Backups

Insiders on macOS:

~/Library/Application Support/Code - Insiders/Backups
  • Unfortunately it says `bash: cd: /home/a/.config/code: No such file or directory` but I am still interested to know how can I activate this feature to atleast save my codes/life for the future? – Hasani Jun 09 '23 at 16:02