如何配置VS Code在切换分支时自动关闭已删除的文件?

Cha*_*ish 4 visual-studio-code

VS Code 有没有办法让它在切换分支时自动关闭已删除的文件选项卡?我倾向于在Tower中切换分支,当我返回 VS Code 时,一堆已删除的文件仍然显示为打开的选项卡。当我在整个项目中进行重命名时,这会导致混乱,因为它会将文件重新添加回项目。

有没有办法解决这个问题,让它在切换分支时关闭已删除的文件选项卡?

Mar*_*ark 9

我认为您想要启用:

"workbench.editor.closeOnFileDelete": true,  // default is false
Run Code Online (Sandbox Code Playgroud)

Controls whether editors showing a file that was opened during the session should close automatically when getting deleted or renamed by some other process. Disabling this will keep the editor open on such an event. Note that deleting from within the application will always close the editor and that dirty files will never close to preserve your data.

The files would be deleted immediately in vscode when deleted in another application - if that is what you want, not only when you switch branches.