Diff tool not launching #1879
|
I can't seem to get the diff tool to launch when running I've also tried manually calling When I check the resolved tools, it lists Am I supposed to add some more configuration or launch the tool explicitly (I expect not)? I've read most of the documentation and looked through issues. I found this one talking about verifying a byte array #1562 which is also what I'm doing (the byte array represents a UTF-8 encoded file without a BOM). It also mentioned diff tools not launching. edit: When I install DiffEngineTray, it does allow me to accept or discard the received file, but there's also no option to see a diff. Perhaps it's not supposed to work for binary arrays? edit2: When I instead verify it as text, it indeed launches neovim, so it does seem to work properly on my machine; the only question that remains is about whether there's any support for visualizing binary files. |
Replies: 3 comments 2 replies
|
Verify(byte[]) defaults the extension to bin, and no text diff tool registers .bin, so DiffEngine has nothing to launch — that's why the tray offers accept/discard but no diff. Pass an extension instead: |
the idea of diff tool launching is to show something that is understandable to a person. it is rare that raw binary meets that requirement |
|
If a hex view is genuinely what's wanted, a custom tool can be registered for a Note the leading dot: Option A — clone an already-resolving tool. Beyond Compare has a hex compare mode and is already a known tool, so this is the least work: using System.Runtime.CompilerServices;
using DiffEngine;
using EmptyFiles;
public static class ModuleInit
{
[ModuleInitializer]
public static void Init()
{
var emptyHex = Path.Combine(Path.GetTempPath(), "empty.hex");
File.WriteAllBytes(emptyHex, []);
AllFiles.UseFile(Category.Binary, emptyHex);
DiffTools.AddToolBasedOn(
DiffTool.BeyondCompare,
name: "BeyondCompareHex",
binaryExtensions: [".hex"]);
}
}Option B — a standalone tool by path: [ModuleInitializer]
public static void Init()
{
var emptyHex = Path.Combine(Path.GetTempPath(), "empty.hex");
File.WriteAllBytes(emptyHex, []);
AllFiles.UseFile(Category.Binary, emptyHex);
DiffTools.AddTool(
name: "HexDiff",
autoRefresh: false,
isMdi: false,
supportsText: false,
requiresTarget: true,
useShellExecute: true,
launchArguments: new(
Left: (temp, target) => $"\"{target}\" \"{temp}\"",
Right: (temp, target) => $"\"{temp}\" \"{target}\""),
exePath: @"%ProgramFiles%\VBinDiff\vbindiff.exe",
binaryExtensions: [".hex"]);
}Then: await Verify(bytes, extension: "hex");
Docs:
One aside: Beyond Compare's built-in definition already registers |
Verify(byte[]) defaults the extension to bin, and no text diff tool registers .bin, so DiffEngine has nothing to launch — that's why the tray offers accept/discard but no diff. Pass an extension instead:
await Verify(bytes, extension: "txt").