Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
94 lines (72 loc) · 3.69 KB

File metadata and controls

94 lines (72 loc) · 3.69 KB
Copy raw file
Download raw file
Outline
Edit and raw actions

Custom Diff Tool

A custom tool can be added by calling DiffTools.AddTool

var resolvedTool = DiffTools.AddTool(
    name: "MyCustomDiffTool",
    autoRefresh: true,
    isMdi: false,
    supportsText: true,
    requiresTarget: true,
    launchArguments: new(
        Left: (tempFile, targetFile) => $"\"{targetFile}\" \"{tempFile}\"",
        Right: (tempFile, targetFile) => $"\"{tempFile}\" \"{targetFile}\""),
    exePath: diffToolPath,
    binaryExtensions: [".jpg"])!;

snippet source | anchor

Add a tool based on existing resolved tool:

var resolvedTool = DiffTools.AddToolBasedOn(
    DiffTool.VisualStudio,
    name: "MyCustomDiffTool",
    launchArguments: new(
        Left: (temp, target) => $"\"custom args \"{target}\" \"{temp}\"",
        Right: (temp, target) => $"\"custom args \"{temp}\" \"{target}\""))!;

snippet source | anchor

Resolution order

New tools are added to the top of the order, the last tool added will resolve before any existing tools. So when the following is executed the last tool that supports the file types will launch:

await DiffRunner.LaunchAsync(tempFile, targetFile);

snippet source | anchor

Alternatively the instance returned from AddTool* can be used to explicitly launch that tool.

var resolvedTool = DiffTools.AddToolBasedOn(
    DiffTool.VisualStudio,
    name: "MyCustomDiffTool",
    launchArguments: new(
        Left: (temp, target) => $"\"custom args \"{target}\" \"{temp}\"",
        Right: (temp, target) => $"\"custom args \"{temp}\" \"{target}\""));

await DiffRunner.LaunchAsync(resolvedTool!, "PathToTempFile", "PathToTargetFile");

snippet source | anchor

exePath

exePath is the path to the executable.

If the file cannot be found AddTool* will return null.

Path conventions

So for example %ProgramFiles(x86)%\Microsoft Visual Studio\*\*\Common7\IDE\devenv.exe might discover the following:

  • C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\devenv.exe
  • C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.exe

Then C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\devenv.exe will be used.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.