Reputation: 713
We have a JSON file that contains large texts as strings inside JSON objects. Those strings and thus the lines they are in get quite long. When making changes to the texts, we would like to better see the changes.
git diff --word-diff
on a console works perfectly for visualizing the words that have been changed.
I created a diff-wrapper.sh script to make this the default behaviour:
#!/bin/sh
git --no-pager diff --color-words "$2" "$5"
exit 0
And set it (for this repository):
git config diff.external ./diff-wrapper.sh
Now, I would like to see the same output in VS Code's diff window, but I don't.
Is there a setting for achieving this? Either by making VS Code use the native git diff command for that repository or by setting a similar "external" diff command in the VS Code preferences? On https://code.visualstudio.com/docs/customization/userandworkspace, I only find these options for the diff editor:
// 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,
Additionally: The terminal wraps long lines in the diff, VS Code does not. Is there a setting to do that in diffs?
Upvotes: 17
Views: 2313
Reputation: 180885
On this part of your question there has been movement:
Additionally: The terminal wraps long lines in the diff, VS Code does not. Is there a setting to do that in diffs?
See https://github.com/microsoft/vscode/pull/110268 Supporting word wrap in the diff editor.
It should hit the Insiders' Build v1.52 very soon.
Upvotes: 1