如何暂时禁用“防止脏写"Visual Studio Code 中的功能 [英] How to temporarily disable "preventing dirty writes" feature in Visual Studio Code
问题描述
在我的项目中,我使用了一些构建/linting 工具,因此它们可以根据某些约定代码样式自动强制更改我的代码,但是当我运行这些脚本时,vs 代码显示了一条错误消息:无法保存
并继续打开解决以保存冲突"选项卡.这对我来说似乎很烦人,也不方便.
那你能告诉我如何暂时禁用VScode的这个功能吗?
v1.42 正在修改此功能,包括添加一个设置,以便可以禁用脏文件/保存冲突通知.请参阅
<块引用>动机是通知您保存将覆盖即使文件在文件之后被更改,磁盘上的内容变脏了.单击比较"按钮可让您查看更改连同磁盘上的版本并覆盖或还原文件.
如果您知道可以覆盖磁盘上的更改,现在通知上直接有一个覆盖按钮.你可以还可以全局或每个工作区配置 files.saveConflictResolution
或文件类型以完全禁用通知.选项是 askUser
(默认)或 overwriteFileOnDisk
.
In my project, I've used some build/linting tools so they can automate force change my code based on some convention code styles but when I was running those scripts, vs code showed an error message:
Failed to save "<file-name>": The content on disk is newer. Please compare your version with the one on disk.
and continue to open the "Resolve to save conflict" tab.
It seems to be annoying and not convenient for me.
So can you tell me how to disable this feature of VScode for a temporarily time?
v1.42 is modifying this functionality including adding a setting so that the dirty file/save conflict notification can be disabled. See https://github.com/microsoft/vscode-docs/blob/vnext/release-notes/v1_42.md#ignore-save-conflicts
Ignore save conflicts
VS Code has a built-in mechanism to show an error when you try to save a dirty file that has been changed outside of VS Code or by another program (for example Git):
The motivation is to inform you that saving will overwrite the contents on disk even though the file was changed after the file became dirty. Clicking the Compare button lets you review your change along with the version on disk and either overwrite or revert the file.
In cases where you know that the changes on disk can be overwritten, there is now an Overwrite button directly on the notification. You can also configure
files.saveConflictResolution
globally or per workspace or file type to disable the notification altogether. The options areaskUser
(default) oroverwriteFileOnDisk
.
这篇关于如何暂时禁用“防止脏写"Visual Studio Code 中的功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!