Skip to content

Commit

Permalink
Implement SkippDiff
Browse files Browse the repository at this point in the history
  • Loading branch information
chidozieononiwu committed Jul 19, 2024
1 parent 1661611 commit 2233383
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
10 changes: 10 additions & 0 deletions src/dotnet/APIView/APIViewWeb/Helpers/CodeFileHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,11 @@ private static void BuildTokensForDiffNodes(CodePanelData codePanelData, CodePan
{
var token = beforeTokens[beforeIndex++];

if (codePanelRawData.ApplySkipDiff && token.TagsObj.Contains(StructuredToken.SKIPP_DIFF))
{
continue;
}

if (token.Kind == StructuredTokenKind.LineBreak)
{
break;
Expand Down Expand Up @@ -429,6 +434,11 @@ private static void BuildTokensForDiffNodes(CodePanelData codePanelData, CodePan
{
var token = afterTokens[afterIndex++];

if (codePanelRawData.ApplySkipDiff && token.TagsObj.Contains(StructuredToken.SKIPP_DIFF))
{
continue;
}

if (token.Kind == StructuredTokenKind.LineBreak)
{
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public class CodePanelRawData
public List<APITreeNode> APIForest { get; set; } = new List<APITreeNode>();
public CodeDiagnostic[] Diagnostics { get; set; } = new CodeDiagnostic[0];
public string Language { get; set; }
public bool ApplySkipDiff { get; set; }
}

public class CodePanelRowData
Expand Down
6 changes: 3 additions & 3 deletions src/dotnet/APIView/APIViewWeb/Managers/CodeFileManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using APIViewWeb.Managers.Interfaces;
using APIViewWeb.Models;
using APIViewWeb.Repositories;
using Microsoft.CodeAnalysis.Host;

namespace APIViewWeb.Managers
{
Expand Down Expand Up @@ -208,11 +207,12 @@ public async Task<bool> AreAPICodeFilesTheSame(RenderedCodeFile codeFileA, Rende

if (LanguageServiceHelpers.UseTreeStyleParser(codeFileA.CodeFile.Language))
{
var diffTree =CodeFileHelpers.ComputeAPIForestDiff(codeFileA.CodeFile.APIForest, codeFileB.CodeFile.APIForest);
var diffTree = CodeFileHelpers.ComputeAPIForestDiff(codeFileA.CodeFile.APIForest, codeFileB.CodeFile.APIForest);
var codePanelRawData = new CodePanelRawData()
{
APIForest = diffTree,
Language = codeFileA.CodeFile.Language
Language = codeFileA.CodeFile.Language,
ApplySkipDiff = true
};
var result = await CodeFileHelpers.GenerateCodePanelDataAsync(codePanelRawData);
return !result.HasDiff;
Expand Down
2 changes: 1 addition & 1 deletion src/dotnet/APIView/apiview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ parameters:
default: 'https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json'
- name: CSharpAPIParserVersion
type: string
default: '1.0.0-dev.20240716.16'
default: '1.0.0-dev.20240719.1'

trigger:
branches:
Expand Down

0 comments on commit 2233383

Please sign in to comment.