Skip to content

Commit

Permalink
Skip Docs when comparing APIRevisions
Browse files Browse the repository at this point in the history
  • Loading branch information
chidozieononiwu committed Jul 23, 2024
1 parent 9df86c3 commit 9bbef98
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
26 changes: 16 additions & 10 deletions src/dotnet/APIView/APIViewWeb/Helpers/CodeFileHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -421,12 +421,15 @@ private static void BuildTokensForDiffNodes(CodePanelData codePanelData, CodePan

if (beforeTokenRow.Count > 0)
{
beforeTokensInProcess.Enqueue(new DiffLineInProcess()
if (!(codePanelRawData.SkipDocsWhenDiffing && beforeRowGroupId == StructuredToken.DOCUMENTATION))
{
GroupId = beforeRowGroupId,
RowOfTokens = beforeTokenRow,
TokenIdsInRow = new HashSet<string>(beforeTokenIdsInRow)
});
beforeTokensInProcess.Enqueue(new DiffLineInProcess()
{
GroupId = beforeRowGroupId,
RowOfTokens = beforeTokenRow,
TokenIdsInRow = new HashSet<string>(beforeTokenIdsInRow)
});
}
beforeTokenIdsInRow.Clear();
}

Expand Down Expand Up @@ -461,12 +464,15 @@ private static void BuildTokensForDiffNodes(CodePanelData codePanelData, CodePan

if (afterTokenRow.Count > 0)
{
afterTokensInProcess.Enqueue(new DiffLineInProcess()
if (!(codePanelRawData.SkipDocsWhenDiffing && afterRowGroupId == StructuredToken.DOCUMENTATION))
{
GroupId = afterRowGroupId,
RowOfTokens = afterTokenRow,
TokenIdsInRow = new HashSet<string>(afterTokenIdsInRow)
});
afterTokensInProcess.Enqueue(new DiffLineInProcess()
{
GroupId = afterRowGroupId,
RowOfTokens = afterTokenRow,
TokenIdsInRow = new HashSet<string>(afterTokenIdsInRow)
});
}
afterTokenIdsInRow.Clear();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using APIView;
using APIView.TreeToken;
using APIViewWeb.Models;
using MongoDB.Bson.IO;

namespace APIViewWeb.LeanModels
{
Expand Down Expand Up @@ -68,6 +69,7 @@ public class CodePanelRawData
public CodeDiagnostic[] Diagnostics { get; set; } = new CodeDiagnostic[0];
public string Language { get; set; }
public bool ApplySkipDiff { get; set; }
public bool SkipDocsWhenDiffing { get; set; }
}

public class CodePanelRowData
Expand Down
1 change: 1 addition & 0 deletions src/dotnet/APIView/APIViewWeb/Managers/CodeFileManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ public async Task<bool> AreAPICodeFilesTheSame(RenderedCodeFile codeFileA, Rende
{
APIForest = diffTree,
Language = codeFileA.CodeFile.Language,
SkipDocsWhenDiffing = true,
ApplySkipDiff = true
};
var result = await CodeFileHelpers.GenerateCodePanelDataAsync(codePanelRawData);
Expand Down

0 comments on commit 9bbef98

Please sign in to comment.