可以在VS Code中重新打开来自资源管理器的文件吗?

huangapple go评论89阅读模式
英文:

Is it possible to redo the files from explorer in VS Code?

问题

我在VS Code的资源管理器面板中不小心按了7-8次Ctrl+Z,导致一些文件被更改了。而且在资源管理器中似乎无法使用Ctrl+Y来恢复所有更改!

我想确认一下,是否有任何方法可以撤销我在资源管理器中进行的那些Ctrl+Z操作的相反操作?

附注:我之所以进行那些Ctrl+Z操作,是因为我使用Ctrl+Shift+H更改了一个变量的名称,并以为在资源管理器中执行Ctrl+Z可以撤消那些名称更改,但似乎我丢失了许多代码和文件!

英文:

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!!

答案1

得分: 1

你可以使用重做命令:Ctrl+Shift+Z(macOS上为command+Shift+Z)。

键盘快捷键可以在VS Code中自定义。

  • 转到文件 > 首选项 > 键盘快捷键(macOS上为代码 > 首选项 > 键盘快捷键)。

  • 在搜索栏中搜索重做

你可以在那里找到快捷键。或者如果你愿意,可以更改它。

如果你已经使用了替换全部(Ctrl + Shift + H),你可能需要打开单个文件。

P.S. 如果你已经关闭了VS Code,可能无法还原:

  • 它只在你没有关闭VS Code的情况下有效。一旦关闭,你就无法还原。
  • 如果你在撤销之后没有进行任何更改,任何在撤销之后进行的更改都将成为最新的,并覆盖之前的修改。

我建议你在一个新文件中尝试这些操作,然后应用你的发现。

英文:

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.

答案2

得分: 1

未保存的文件可以被暂时存储。

您尝试过检查以下目录吗?

Windows 用户:

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

对于 Linux 用户,它们可以在以下位置找到:

~/.config/Code/Backups

macOS 上的 Insiders 版本:

~/Library/Application Support/Code - Insiders/Backups

英文:

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

huangapple
  • 本文由 发表于 2023年6月9日 14:03:29
  • 转载请务必保留本文链接:https://go.coder-hub.com/76437602.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定