|
|
@@ -21,6 +21,13 @@ export class ComparisonFactory {
|
|
|
);
|
|
|
|
|
|
const matches = json.matches as Array<Record<string, unknown>>;
|
|
|
+
|
|
|
+ // Quick fix for issue #658, requires deeper insights to be resolved completely
|
|
|
+ matches.forEach((match: Record<string, unknown>) => {
|
|
|
+ match["file1"] = this.removePathFromFileName(match["file1"] as string ?? "");
|
|
|
+ match["file2"] = this.removePathFromFileName(match["file2"] as string ?? "");
|
|
|
+ })
|
|
|
+
|
|
|
const colors = this.generateColorsForMatches(matches.length);
|
|
|
const coloredMatches = matches.map((match, index) =>
|
|
|
this.mapMatch(match, colors[index])
|
|
|
@@ -71,9 +78,11 @@ export class ComparisonFactory {
|
|
|
matches.forEach((val) => {
|
|
|
const name =
|
|
|
index === 1 ? (val.firstFile as string) : (val.secondFile as string);
|
|
|
+
|
|
|
if (!acc.get(name)) {
|
|
|
acc.set(name, []);
|
|
|
}
|
|
|
+
|
|
|
if (index === 1) {
|
|
|
const newVal: MatchInSingleFile = {
|
|
|
start: val.startInFirst as number,
|
|
|
@@ -99,6 +108,10 @@ export class ComparisonFactory {
|
|
|
return acc;
|
|
|
}
|
|
|
|
|
|
+ private static removePathFromFileName(filePath: string): string {
|
|
|
+ return filePath.substring(filePath.lastIndexOf("\\") + 1).substring(filePath.lastIndexOf("/") + 1);
|
|
|
+ }
|
|
|
+
|
|
|
private static generateColorsForMatches(num: number): Array<string> {
|
|
|
const colors = [];
|
|
|
const hueDelta = Math.trunc(360 / num);
|