From 4bb86cae59f01479355d85d0b71f34f1c86e86b8 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Wed, 4 Nov 2026 22:54:02 +1100 Subject: [PATCH] Restore Code Compare support Code Compare was removed in #370 as unmaintained, and Devart has released 5.4.20, 5.4.27 and 5.5.11 since. It goes back in its old place in the order, after SublimeMerge. It is launched with /environment=standalone. Left to itself Code Compare opens a comparison in a Visual Studio that has the file in a project, a running Code Compare or any running Visual Studio, and asks which when more than one is open; VisualStudio is a tool of its own here. --- docs/diff-tool.md | 39 ++++++++++++++++++++ docs/diff-tool.order.md | 1 + readme.md | 1 + src/DiffEngine.Tests/defaultOrder.include.md | 1 + src/DiffEngine.Tests/diffToolList.include.md | 1 + src/DiffEngine.Tests/diffTools.include.md | 39 ++++++++++++++++++++ src/DiffEngine/Definitions.cs | 1 + src/DiffEngine/DiffTool.cs | 1 + src/DiffEngine/Implementation/CodeCompare.cs | 36 ++++++++++++++++++ 9 files changed, 120 insertions(+) create mode 100644 src/DiffEngine/Implementation/CodeCompare.cs diff --git a/docs/diff-tool.md b/docs/diff-tool.md index 2db6347e5..50b2e5cbe 100644 --- a/docs/diff-tool.md +++ b/docs/diff-tool.md @@ -1242,6 +1242,45 @@ DiffTools.UseOrder(DiffTool.AraxisMerge); * `/Applications/Araxis Merge.app/Contents/Utilities/compare` * `%PATH%compare` +### [CodeCompare](https://www.devart.com/codecompare/) + + * Cost: Free and Paid + * Is MDI: True + * Supports auto-refresh: False + * Supports text files: True + * Use shell execute: True + * Create no window: False + * Environment variable for custom install location: `DiffEngine_CodeCompare` + +#### Tool order: + +Use [tool order](diff-tool.order.md) to prioritise CodeCompare over other tools. + +``` +DiffTools.UseOrder(DiffTool.CodeCompare); +``` + +#### Notes: + + * [Command line reference](https://docs.devart.com/code-compare/using-command-line/comparing-via-command-line.html) + * Launched with `/environment=standalone`, so a diff always opens in Code Compare rather than in a Visual Studio with the Code Compare extension, and never stops to ask which. [Environment on comparison opening](https://docs.devart.com/code-compare/using-command-line/choosing-environment-on-comparison-opening.html) + +#### Windows settings: + + * Example target on left arguments: + ``` + /environment=standalone "targetFile.txt" "tempFile.txt" + ``` + * Example target on right arguments: + ``` + /environment=standalone "tempFile.txt" "targetFile.txt" + ``` + * Scanned paths: + * `%ProgramFiles%\Devart\Code Compare\CodeCompare.exe` + * `%ProgramW6432%\Devart\Code Compare\CodeCompare.exe` + * `%ProgramFiles(x86)%\Devart\Code Compare\CodeCompare.exe` + * `%PATH%CodeCompare.exe` + ### [Cursor](https://cursor.com) * Cost: Free and Paid diff --git a/docs/diff-tool.order.md b/docs/diff-tool.order.md index 4cd981d97..f2e8f2e46 100644 --- a/docs/diff-tool.order.md +++ b/docs/diff-tool.order.md @@ -32,6 +32,7 @@ To change this file edit the source file and then run MarkdownSnippets. * **[AraxisMerge](/docs/diff-tool.md#araxismerge)** Windows/OSX (Cost: Paid) * **[Meld](/docs/diff-tool.md#meld)** Windows/OSX/Linux (Cost: Free) * **[SublimeMerge](/docs/diff-tool.md#sublimemerge)** Windows/OSX/Linux (Cost: Paid) + * **[CodeCompare](/docs/diff-tool.md#codecompare)** Windows (Cost: Free and Paid) * **[VisualStudioCode](/docs/diff-tool.md#visualstudiocode)** Windows/OSX/Linux (Cost: Free) * **[VisualStudio](/docs/diff-tool.md#visualstudio)** Windows (Cost: Paid and free options) * **[Cursor](/docs/diff-tool.md#cursor)** Windows/OSX/Linux (Cost: Free and Paid) diff --git a/readme.md b/readme.md index 8994575e5..b0e8d27d7 100644 --- a/readme.md +++ b/readme.md @@ -70,6 +70,7 @@ DiffEngine manages launching and cleanup of diff tools. It is designed to be use * **[AraxisMerge](/docs/diff-tool.md#araxismerge)** Windows/OSX (Cost: Paid) * **[BeyondCompare](/docs/diff-tool.md#beyondcompare)** Windows/OSX/Linux (Cost: Paid) + * **[CodeCompare](/docs/diff-tool.md#codecompare)** Windows (Cost: Free and Paid) * **[Cursor](/docs/diff-tool.md#cursor)** Windows/OSX/Linux (Cost: Free and Paid) * **[DeltaWalker](/docs/diff-tool.md#deltawalker)** Windows/OSX (Cost: Paid) * **[DiffEngineViewer](/docs/diff-tool.md#diffengineviewer)** Windows/OSX/Linux (Cost: Free) diff --git a/src/DiffEngine.Tests/defaultOrder.include.md b/src/DiffEngine.Tests/defaultOrder.include.md index 829cd9188..428aac492 100644 --- a/src/DiffEngine.Tests/defaultOrder.include.md +++ b/src/DiffEngine.Tests/defaultOrder.include.md @@ -20,6 +20,7 @@ * **[AraxisMerge](/docs/diff-tool.md#araxismerge)** Windows/OSX (Cost: Paid) * **[Meld](/docs/diff-tool.md#meld)** Windows/OSX/Linux (Cost: Free) * **[SublimeMerge](/docs/diff-tool.md#sublimemerge)** Windows/OSX/Linux (Cost: Paid) + * **[CodeCompare](/docs/diff-tool.md#codecompare)** Windows (Cost: Free and Paid) * **[VisualStudioCode](/docs/diff-tool.md#visualstudiocode)** Windows/OSX/Linux (Cost: Free) * **[VisualStudio](/docs/diff-tool.md#visualstudio)** Windows (Cost: Paid and free options) * **[Cursor](/docs/diff-tool.md#cursor)** Windows/OSX/Linux (Cost: Free and Paid) diff --git a/src/DiffEngine.Tests/diffToolList.include.md b/src/DiffEngine.Tests/diffToolList.include.md index 59b0f31c1..11391be66 100644 --- a/src/DiffEngine.Tests/diffToolList.include.md +++ b/src/DiffEngine.Tests/diffToolList.include.md @@ -1,5 +1,6 @@ * **[AraxisMerge](/docs/diff-tool.md#araxismerge)** Windows/OSX (Cost: Paid) * **[BeyondCompare](/docs/diff-tool.md#beyondcompare)** Windows/OSX/Linux (Cost: Paid) + * **[CodeCompare](/docs/diff-tool.md#codecompare)** Windows (Cost: Free and Paid) * **[Cursor](/docs/diff-tool.md#cursor)** Windows/OSX/Linux (Cost: Free and Paid) * **[DeltaWalker](/docs/diff-tool.md#deltawalker)** Windows/OSX (Cost: Paid) * **[DiffEngineViewer](/docs/diff-tool.md#diffengineviewer)** Windows/OSX/Linux (Cost: Free) diff --git a/src/DiffEngine.Tests/diffTools.include.md b/src/DiffEngine.Tests/diffTools.include.md index 149acf51d..fc198e5e8 100644 --- a/src/DiffEngine.Tests/diffTools.include.md +++ b/src/DiffEngine.Tests/diffTools.include.md @@ -1074,6 +1074,45 @@ DiffTools.UseOrder(DiffTool.AraxisMerge); * `/Applications/Araxis Merge.app/Contents/Utilities/compare` * `%PATH%compare` +### [CodeCompare](https://www.devart.com/codecompare/) + + * Cost: Free and Paid + * Is MDI: True + * Supports auto-refresh: False + * Supports text files: True + * Use shell execute: True + * Create no window: False + * Environment variable for custom install location: `DiffEngine_CodeCompare` + +#### Tool order: + +Use [tool order](diff-tool.order.md) to prioritise CodeCompare over other tools. + +``` +DiffTools.UseOrder(DiffTool.CodeCompare); +``` + +#### Notes: + + * [Command line reference](https://docs.devart.com/code-compare/using-command-line/comparing-via-command-line.html) + * Launched with `/environment=standalone`, so a diff always opens in Code Compare rather than in a Visual Studio with the Code Compare extension, and never stops to ask which. [Environment on comparison opening](https://docs.devart.com/code-compare/using-command-line/choosing-environment-on-comparison-opening.html) + +#### Windows settings: + + * Example target on left arguments: + ``` + /environment=standalone "targetFile.txt" "tempFile.txt" + ``` + * Example target on right arguments: + ``` + /environment=standalone "tempFile.txt" "targetFile.txt" + ``` + * Scanned paths: + * `%ProgramFiles%\Devart\Code Compare\CodeCompare.exe` + * `%ProgramW6432%\Devart\Code Compare\CodeCompare.exe` + * `%ProgramFiles(x86)%\Devart\Code Compare\CodeCompare.exe` + * `%PATH%CodeCompare.exe` + ### [Cursor](https://cursor.com) * Cost: Free and Paid diff --git a/src/DiffEngine/Definitions.cs b/src/DiffEngine/Definitions.cs index 436968381..be0394ae7 100644 --- a/src/DiffEngine/Definitions.cs +++ b/src/DiffEngine/Definitions.cs @@ -30,6 +30,7 @@ static Definitions() => Implementation.AraxisMerge(), Implementation.Meld(), Implementation.SublimeMerge(), + Implementation.CodeCompare(), Implementation.VisualStudioCode(), Implementation.VisualStudio(), Implementation.Cursor(), diff --git a/src/DiffEngine/DiffTool.cs b/src/DiffEngine/DiffTool.cs index 0ab10a4ce..2c5567850 100644 --- a/src/DiffEngine/DiffTool.cs +++ b/src/DiffEngine/DiffTool.cs @@ -26,6 +26,7 @@ public enum DiffTool AraxisMerge, Meld, SublimeMerge, + CodeCompare, VisualStudioCode, VisualStudio, Cursor, diff --git a/src/DiffEngine/Implementation/CodeCompare.cs b/src/DiffEngine/Implementation/CodeCompare.cs new file mode 100644 index 000000000..912356a8e --- /dev/null +++ b/src/DiffEngine/Implementation/CodeCompare.cs @@ -0,0 +1,36 @@ +namespace DiffEngine; + +static partial class Implementation +{ + public static Definition CodeCompare() + { + // Left to itself Code Compare picks where a comparison opens: the Visual Studio a file + // belongs to a project of, a running Code Compare, or any running Visual Studio, and with + // more than one of them open it stops and asks which. A test run has the verified file in + // a project, so the diff would go into Visual Studio, which is a tool of its own here + var launchArguments = new LaunchArguments( + Left: (temp, target) => $"/environment=standalone \"{target}\" \"{temp}\"", + Right: (temp, target) => $"/environment=standalone \"{temp}\" \"{target}\""); + + return new( + Tool: DiffTool.CodeCompare, + Url: "https://www.devart.com/codecompare/", + AutoRefresh: false, + // A comparison opens as a tab in whichever Code Compare is already running + IsMdi: true, + SupportsText: true, + UseShellExecute: true, + RequiresTarget: true, + Cost: "Free and Paid", + BinaryExtensions: [], + OsSupport: new( + Windows: new( + "CodeCompare.exe", + launchArguments, + @"%ProgramFiles%\Devart\Code Compare\")), + Notes: """ + * [Command line reference](https://docs.devart.com/code-compare/using-command-line/comparing-via-command-line.html) + * Launched with `/environment=standalone`, so a diff always opens in Code Compare rather than in a Visual Studio with the Code Compare extension, and never stops to ask which. [Environment on comparison opening](https://docs.devart.com/code-compare/using-command-line/choosing-environment-on-comparison-opening.html) + """); + } +}