Skip to content

Commit 3ca2b8d

Browse files
committed
Update DiffTools.cs
1 parent ae3e78f commit 3ca2b8d

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/DiffEngine/DiffTools.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,22 @@ public static void UseOrder(in bool throwForNoTool, params DiffTool[] order)
3535
InitTools(throwForNoTool, order);
3636
}
3737

38-
public static bool IsDetectedForFile(DiffTool diffTool, string path) =>
39-
IsDetectedForExtension(diffTool, Path.GetExtension(path));
38+
public static bool IsDetectedForFile(DiffTool diffTool, string path)
39+
{
40+
var tool = resolved.SingleOrDefault(_ => _.Tool == diffTool);
41+
if (tool == null)
42+
{
43+
return false;
44+
}
45+
46+
if (FileExtensions.IsTextFile(path))
47+
{
48+
return tool.SupportsText;
49+
}
50+
51+
var extension = Path.GetExtension(path);
52+
return tool.BinaryExtensions.Contains(extension);
53+
}
4054

4155
public static bool IsDetectedForExtension(DiffTool diffTool, string extension)
4256
{

0 commit comments

Comments
 (0)