我们有一个JSON文件,它包含大型文本作为JSON对象中的字符串 . 这些字符串以及它们所在的行很长 . 在对文本进行更改时,我们希望更好地了解更改 .

git diff --word-diff

在控制台上完美地工作以可视化已更改的单词 .

我创建了一个diff-wrapper.sh脚本,使其成为默认行为:

#!/bin/sh
git --no-pager diff --color-words "$2" "$5"
exit 0

并设置它(对于此存储库):

git config diff.external ./diff-wrapper.sh

现在,我想在VS Code的diff窗口中看到相同的输出,但我没有 .

是否有实现这一目标的环境?通过使VS代码使用该存储库的本机git diff命令或通过在VS代码首选项中设置类似的"external" diff命令?在https://code.visualstudio.com/docs/customization/userandworkspace上,我只为diff编辑器找到这些选项:

// Controls if the diff editor shows the diff side by side or inline
"diffEditor.renderSideBySide": true,

// Controls if the diff editor shows changes in leading or trailing whitespace as diffs
"diffEditor.ignoreTrimWhitespace": true,

另外:终端在diff中包含长行,而VS Code则没有 . 在差异中有没有设置呢?