Auto-saving files upon changes with VSCode

佐手、 提交于 2020-04-08 08:34:11

问题


I have used WebStorm from JetBrains for almost 4 years now. It's a fantastic IDE for many reasons, but one of the best features is that it saves versions of files outside of version control. So if you accidentally delete files or lose files before they are saved by your VCS, WebStorm has a copy of them and there are visual diff tools to use. This feature has saved my ass on more than one occasion.

My question is - for VSCode is there some feature/plugin that will auto-save copies of files as they change? VSCode will save the files to some central location, or perhaps in the .vscode folder in the local workspace?

The feature in WebStorm is available from "Local History -> Show History" from a folder or file. Here is an article about it: https://blog.jetbrains.com/phpstorm/2012/10/using-local-history-for-code-changes-tracking/

The view looks like:


回答1:


you can go to menu Files and choose auto save.




回答2:


Yes VSCode can auto-save changes on files as you make changes. It also allows you set a delay for how long to wait before saving the file.

Here's a link that should help you with that.

Or a shortcut you can simply navigate to your VSCode settings, and add the following to your settings.json

{
    ...
    "files.autoSave": "afterDelay",
    "files.autoSaveDelay": 1000,
    ...
}

This will instruct your editor to autosave after 1000ms delay. You can set the autosave option to onFocusChange to autosave whenever you move your cursor away from the current text area.




回答3:


You can enable auto save with this methods:

1: check Auto Save item in File menu

2: Go to Setting, then search auto save and select auto save option (afterDelay)

Auto save description in vs code documentation




回答4:


in VC Code

File -> Auto Save (Click on it)




回答5:


There's a package called Local History that can be used to save a backup of your files outside version control.

You should check that out.



来源:https://stackoverflow.com/questions/53181761/auto-saving-files-upon-changes-with-vscode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!