忽略 VisualStudio 代码 git diff 视图中的空白

在 VisualStudio 代码中查看文件(由 GIT 生成)的代码差异时,是否可以忽略空白?这对于在提交之前检查实际的代码添加/删除非常有帮助。

53707 次浏览

Add on your settings.json:

"diffEditor.ignoreTrimWhitespace": true,

I believe OP is asking to ignore all whitespaces (including between words) not just trailing whitespaces.
Unfortunately, it's still not implemented and you can track the process status here: https://github.com/Microsoft/vscode/issues/43026

On the top right corner in diff view, there is a "Show Leading/Trailing Whitespace Differences" button (¶, called pilcrow or paragraph mark) to trim whitespace:

The "Show Leading/Trailing Whitespace Differences" button in VSCode Git Diff

One idea is to format the documents using the same formatting standard and then compare the files.