Preventing dirty writes in VSCode

VS Code will show you an error message when you try to save a file that cannot be saved because it has changed on disk–usually when two people are editing a document at the same time.

VS Code blocks saving the file to prevent overwriting changes that have been made outside of the editor.

Preventing dirty writes in VSCode

In order to resolve the save conflict, click the Compare action in the error message to open a diff editor that will show you the contents of the file on disk (to the left) compared to the contents in VS Code (on the right):

Preventing dirty writes in VSCode

Use the actions in the editor toolbar

Preventing dirty writes in VSCode

to resolve the save conflict.

You can either Accept your changes and thereby overwriting any changes on disk,

Preventing dirty writes in VSCode

or Revert to the version on disk. Reverting means that your changes will be lost.

Preventing dirty writes in VSCode

In this case, you click the arrow in the middle line of diff editor –line 23– to resolve the save conflict by accepting other’s changes.

Preventing dirty writes in VSCode

Then click the tick icon to accept your changes and thereby overwriting any changes on disk. The diff editor will be closed automatically.

Note: The file will remain dirty and cannot be saved until you pick one of the two actions to resolve the conflict.

本作品采用《CC 协议》,转载必须注明作者和本文链接
日拱一卒
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!
未填写
文章
88
粉丝
82
喜欢
148
收藏
120
排名:66
访问:11.4 万
私信
所有博文
社区赞助商