Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/Improved Tokens #7980

Merged
merged 8 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/dotnet/APIView/APIView/Analysis/Analyzer.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using ApiView;
Expand All @@ -9,7 +9,7 @@

namespace APIView.Analysis
{
internal class Analyzer : SymbolVisitor
public class Analyzer : SymbolVisitor
chidozieononiwu marked this conversation as resolved.
Show resolved Hide resolved
{
public List<CodeDiagnostic> Results { get; } = new List<CodeDiagnostic>();

Expand Down
4 changes: 2 additions & 2 deletions src/dotnet/APIView/APIView/CodeFileTokensBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) Microsoft Corporation. All rights reserved.
chidozieononiwu marked this conversation as resolved.
Show resolved Hide resolved
// Licensed under the MIT License.

using APIView;
Expand Down Expand Up @@ -78,4 +78,4 @@ public void Comment(string text)
Append(text, CodeFileTokenKind.Comment);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using Microsoft.CodeAnalysis;
Expand All @@ -8,7 +8,7 @@

namespace ApiView
{
class CodeFileBuilderSymbolOrderProvider : ICodeFileBuilderSymbolOrderProvider
public class CodeFileBuilderSymbolOrderProvider : ICodeFileBuilderSymbolOrderProvider
{
public IEnumerable<T> OrderTypes<T>(IEnumerable<T> symbols) where T : ITypeSymbol
{
Expand Down Expand Up @@ -92,4 +92,4 @@ private static int GetMemberOrder(ISymbol symbol)
}
}
}
}
}
7 changes: 1 addition & 6 deletions src/dotnet/APIView/APIView/Model/CodeDiagnostic.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) Microsoft Corporation. All rights reserved.
chidozieononiwu marked this conversation as resolved.
Show resolved Hide resolved
// Licensed under the MIT License.

namespace APIView
Expand All @@ -17,15 +17,10 @@ public CodeDiagnostic(string diagnosticId, string targetId, string text, string
HelpLinkUri = helpLinkUri;
Level = level;
}

public string DiagnosticId { get; set; }

public string Text { get; set; }

public string HelpLinkUri { get; set; }

public string TargetId { get; set; }

public CodeDiagnosticLevel Level { get; set; }
}
}
22 changes: 3 additions & 19 deletions src/dotnet/APIView/APIView/Model/CodeFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT License.

using APIView;
using APIView.TreeToken;
using System;
using System.Collections.Generic;
using System.IO;
Expand All @@ -20,51 +21,34 @@ public class CodeFile
};

private string _versionString;

private static HashSet<string> _collapsibleLanguages = new HashSet<string>(new string[] { "Swagger" });

[Obsolete("This is only for back compat, VersionString should be used")]
public int Version { get; set; }

public string VersionString
{
#pragma warning disable 618
get => _versionString ?? Version.ToString();
#pragma warning restore 618
set => _versionString = value;
}

public string Name { get; set; }

public string Language { get; set; }

public string LanguageVariant { get; set; }

public string PackageName { get; set; }

public string ServiceName { get; set; }

public string PackageDisplayName { get; set; }

public string PackageVersion { get; set; }

public string CrossLanguagePackageId { get; set; }

public CodeFileToken[] Tokens { get; set; } = Array.Empty<CodeFileToken>();

public List<APITreeNode> APIForest { get; set; } = new List<APITreeNode>();
public List<CodeFileToken[]> LeafSections { get; set; }

public NavigationItem[] Navigation { get; set; }

public CodeDiagnostic[] Diagnostics { get; set; }

public override string ToString()
{
return new CodeFileRenderer().Render(this).CodeLines.ToString();
}

}
public static bool IsCollapsibleSectionSSupported(string language) => _collapsibleLanguages.Contains(language);

public static async Task<CodeFile> DeserializeAsync(Stream stream, bool hasSections = false)
{
var codeFile = await JsonSerializer.DeserializeAsync<CodeFile>(
Expand Down
Loading