Ash
Ash

Reputation: 3583

Visual Studio Code: Use Beyond Compare diff tool

The default diff tool of Visual Studio Code is nice, but I'd like to replace it with my beloved Beyond Compare.

It's easy to configure in Visual Studio 2017. It's also configured as the git difftool.

I assumed there should be an extension for Beyond Compare, but I couldn't find one. Also google only delivered results concerning the full VS IDE, but nothing to VSC.

Any suggestions?

Upvotes: 41

Views: 29048

Answers (6)

Wayne Liu
Wayne Liu

Reputation: 1291

The Scooter Software company just released an official VS Code extension, ScooterSoftware.bcompare-vscode.

Upvotes: 11

Justin Ohms
Justin Ohms

Reputation: 3553

For VS Code on Mac OS

1. Install the VS Code Compare Helper Extension

2. Install Beyond Compare command line tools

Inside of Beyond Compare install the command line tools from the menu Install Beyond Compare Command Line Tools enter image description here

3. Add the following to your VSCode settings.json

"compareHelper.defaultExternalTools": {
    "folders": "bcompare",
    "images": "bcompare",
    "text": "bcompare"
},
"compareHelper.externalTools": [
    {
        "name": "bcompare",
        "path": "bcompare",
        "compares": [ "text", "folders", "images" ],
        "args": [
            "${FOLDER_ITEM_1}",
            "${FOLDER_ITEM_2}"
        ]
    }
],

Upvotes: 0

opus131
opus131

Reputation: 2036

There is a better solution now, the "Compare Helper" extension: https://marketplace.visualstudio.com/items?itemName=keewek.compare-helper

Once installed and configured, you can select files or folders from the explorer and compare them via the context menu. Works like a charm, and configuration is trivial:

  "compareHelper.defaultExternalTools": {
    "folders": "bcompare",
    "images": "bcompare",
    "text": "bcompare"
  },
  "compareHelper.externalTools": [
    {
      "name": "bcompare",
      "path": "C:/Program Files/Beyond Compare 4/BCompare.exe",
      "compares": ["text", "folders", "images"]
    }
  ],

enter image description here

Upvotes: 11

opus131
opus131

Reputation: 2036

I came here searching for a solution to use Beyond Compare from within the VS Code sidebar explorer, which is probably not exactly what the OP was after. However, maybe he or others might still find this useful:

There is an extension called "Windows Explorer Context Menu" which adds the option to show the native shell context menu for a selected file or folder in the VS Code explorer.

Once the extension is installed, you can right-click a file or folder, choose Context Menu - Selected and then the desired Beyond Compare operation from the native shell menu.

Unfortunately it does not recognise multiple selected files, so in order to compare two files or folders you have to do this twice, first Select left file/folder for Compare and then Compare (so tbh it's not really easier than just doing a Reveal in Explorer, but at least you can stay inside the VS Code context).

Upvotes: 2

allenyllee
allenyllee

Reputation: 1094

Try this extension:

GitDiffer - Visual Studio Marketplace

It works for me on Windows 10, here is my .gitconfig settings

[difftool "sourcetree"]
    cmd = 'C:/Program Files/Beyond Compare 4/BComp.exe' \"$LOCAL\" \"$REMOTE\"
[mergetool "sourcetree"]
    cmd = 'C:/Program Files/Beyond Compare 4/BComp.exe' \"$LOCAL\" \"$REMOTE\" \"$BASE\" \"$MERGED\"
    trustExitCode = true
[merge]
    tool = sourcetree
[diff]
    guitool = sourcetree

Upvotes: 13

scrthq
scrthq

Reputation: 1076

I would file an issue/enhancement on Microsoft's Github @ the VSCode repo: https://github.com/Microsoft/vscode

Best case, it's doable and someone there can direct you pretty quick on how to accomplish it; worst case it's added as an enhancement request and added into Code itself in due time.

Upvotes: 4

Related Questions