there is 2 things i usually do :
- using local history :
- open command palette
Cmd+Shift+P or (Ctrl+Shift+P)
- Type
Local History: Find Entry to Restore
and choose the file you want to restore


- if you didnt close the vs code yet and you still in same workspace
- click on file explorer and then ctrl z