skip to Main Content

I would like to use the difftastic diff tool, which ignores whitespace changes in code (amongst other useful functionalities), and I have set my .gitconfig to use difft (the binary file of difftastic) as my preferred external diff tool using this command:

git config --global diff.external difft

And, my .gitconfig has these lines in it:

[diff]
    external = difft

However, the VSCode text editor still shows whitespace diffs. I have searched for a way to change the diff tool in VSCode to no avail, the only results are "How to set VSCode as the default merge/diff tool for git".

To clarify, I would like to change the diff tool used by the vscode text editor section as well as the diff viewer. I do not want to change the tool used by the commandline git command itself. In the image I’ve linked, it shows changes for whitespace, which should not be happening if difft is set as the diff tool.

2

Answers


  1. Login or Signup to reply.
  2. Visual Studio Code does not use an external utility to compute the diff. The necessary algorithms are directly implemented in VS Code and you don’t have any control over them.

    Using an arbitrary external utility would most likely not result in a good user experience either. If VS Code cannot understand the generated diff, it would not be able to display the output with the diff editor and you would lose features like syntax highlighting.

    However, I may have an alternative solution to your original problem (using difftastic in VS Code). I am currently working on my own extension that adds a semantic diff mode to VS Code. It supports fewer languages than difftastic, but has additional features like moved code detection:

    Moved code in SemanticDiff

    If that is what you are looking for, you can find the extension (SemanticDiff) in the Visual Studio Code Marketplace.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search