8000 Refactor port to triple slash by carlossanlop · Pull Request #164 · dotnet/api-docs-sync · GitHub
[go: up one dir, main page]

Skip to content

Refactor port to triple slash #164

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

Merged
merged 20 commits into from
Sep 21, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
Refactor roslyn code that generates the xml items.
  • Loading branch information
carlossanlop committed Jul 25, 2023
commit eef7c86c07a732b31f2fced4a9cf9cb2bda140e9
6 changes: 4 additions & 2 deletions src/PortToTripleSlash/src/libraries/Docs/DocsAPI.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
Expand Down Expand Up @@ -195,11 +195,13 @@ public List<DocsRelated> Relateds
}

public abstract string Summary { get; set; }
public abstract string Value { get; set; }
public abstract string ReturnType { get; }
public abstract string Returns { get; set; }

public abstract string Remarks { get; set; }

public abstract List<DocsException> Exceptions { get; }

public List<DocsAssemblyInfo> AssemblyInfos
{
get
Expand Down
6 changes: 3 additions & 3 deletions src/PortToTripleSlash/src/libraries/Docs/DocsMember.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
Expand Down Expand Up @@ -127,7 +127,7 @@ public override string Remarks
}
}

public string Value
public override string Value
{
get
{
Expand All @@ -146,7 +146,7 @@ public string Value
}
}

public List<DocsException> Exceptions
public override List<DocsException> Exceptions
{
get
{
Expand Down
9 changes: 8 additions & 1 deletion src/PortToTripleSlash/src/libraries/Docs/DocsType.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
Expand Down Expand Up @@ -193,6 +193,12 @@ public override string Summary
}
}

public override string Value
{
get => string.Empty;
set => throw new NotSupportedException();
}

/// <summary>
/// Only available when the type is a delegate.
/// </summary>
Expand Down Expand Up @@ -242,6 +248,7 @@ public override string Remarks
SaveFormattedAsMarkdown("remarks", value, addIfMissing: !value.IsDocsEmpty(), isMember: false);
}
}
public override List<DocsException> Exceptions { get; } = new();

public override string ToString()
{
Expand Down
4 changes: 3 additions & 1 deletion src/PortToTripleSlash/src/libraries/Docs/IDocsAPI.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Generic;
Expand All @@ -20,9 +20,11 @@ internal interface IDocsAPI
public abstract List<DocsTypeParameter> TypeParameters { get; }
public abstract List<DocsTypeParam> TypeParams { get; }
public abstract string Summary { get; set; }
public abstract string Value { get; set; }
public abstract string ReturnType { get; }
public abstract string Returns { get; set; }
public abstract string Remarks { get; set; }
public abstract List<DocsException> Exceptions { get; }
public abstract DocsParam SaveParam(XElement xeCoreFXParam);
public abstract DocsTypeParam AddTypeParam(string name, string value);
}
Expand Down
15 changes: 8 additions & 7 deletions src/PortToTripleSlash/src/libraries/ResolvedLocation.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Microsoft.CodeAnalysis;
Expand All @@ -7,19 +7,20 @@ namespace ApiDocsSync.PortToTripleSlash
{
public class ResolvedLocation
{
public string TypeName { get; private set; }
public Compilation Compilation { get; private set; }
public Location Location { get; private set; }
public SyntaxTree Tree { get; set; }
public SemanticModel Model { get; set; }
public string TypeName { get; }
public Compilation Compilation { get; }
public Location Location { get; }
public SyntaxTree Tree { get; }
public SemanticModel Model { get; }
public SyntaxNode? NewNode { get; set; }

public ResolvedLocation(string typeName, Compilation compilation, Location location, SyntaxTree tree)
{
TypeName = typeName;
Compilation = compilation;
Location = location;
Tree = tree;
Model = compilation.GetSemanticModel(Tree);
Model = Compilation.GetSemanticModel(Tree);
}
}
}
11 changes: 6 additions & 5 deletions src/PortToTripleSlash/src/libraries/ResolvedProject.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Microsoft.CodeAnalysis;
Expand All @@ -7,10 +7,11 @@ namespace ApiDocsSync.PortToTripleSlash
{
public class ResolvedProject
{
public ResolvedWorkspace ResolvedWorkspace { get; private set; }
public Project Project { get; private set; }
public Compilation Compilation { get; private set; }
public string ProjectPath { get; private set; }
public ResolvedWorkspace ResolvedWorkspace { get; }
public Project Project { get; }
public Compilation Compilation { get; }
public string ProjectPath { get; }

public ResolvedProject(ResolvedWorkspace resolvedWorkspace, string projectPath, Project project, Compilation compilation)
{
ResolvedWorkspace = resolvedWorkspace;
Expand Down
9 changes: 7 additions & 2 deletions src/PortToTripleSlash/src/libraries/ResolvedWorkspace.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Generic;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Editing;
using Microsoft.CodeAnalysis.MSBuild;

namespace ApiDocsSync.PortToTripleSlash
{
public class ResolvedWorkspace
{
public MSBuildWorkspace Workspace { get; private set; }
public MSBuildWorkspace Workspace { get; }
public List<ResolvedProject> ResolvedProjects { get; }
public SyntaxGenerator Generator { get; }

public ResolvedWorkspace(MSBuildWorkspace workspace)
{
Workspace = workspace;
ResolvedProjects = new List<ResolvedProject>();
Generator = SyntaxGenerator.GetGenerator(workspace, LanguageNames.CSharp);
}
}
}
147 changes: 147 additions & 0 deletions src/PortToTripleSlash/src/libraries/RoslynTripleSlash/TestAllApis.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.


//using System;

//namespace libraries.RoslynTripleSlash.TestAllApis;

///// <summary>
/////
///// </summary>
//interface MyInterface
//{
//}

///// <summary>
/////
///// </summary>
///// <typeparam name="T"></typeparam>
//interface MyInterfaceT<T>
//{
//}

///// <summary>
/////
///// </summary>
//struct MyStruct
//{
//}

///// <summary>
/////
///// </summary>
///// <typeparam name="T"></typeparam>
//struct MyStruct<T>
//{
//}

///// <summary>
/////
///// </summary>
//class MyClass
//{
//}

///// <summary>
/////
///// </summary>
///// <typeparam name="T"></typeparam>
//class MyClass<T>
//{
//}

//class Example
//{
// /// <summary>
// ///
// /// </summary>
// /// <returns></returns>
// delegate int MyDelegate();

// /// <summary>
// ///
// /// </summary>
// /// <typeparam name="T"></typeparam>
// /// <param name="x"></param>
// /// <returns></returns>
// delegate int MyDelegateT<T>(int x);

// /// <summary>
// ///
// /// </summary>
// event MyDelegate MyEvent = null!;

// /// <summary>
// ///
// /// </summary>
// event MyDelegateT<int> MyEventT = null!;

// /// <summary>
// ///
// /// </summary>
// /// <param name="a"></param>
// /// <param name="b"></param> C8E2
// /// <returns></returns>
// public static Example operator +(Example a, Example b)
// {
// _ = a;
// _ = b;
// return null!;
// }

// /// <summary>
// ///
// /// </summary>
// /// <value></value>
// public int MyProperty { get; }

// /// <summary>
// ///
// /// </summary>
// /// <value></value>
// public MyStruct<int> MyPropertyT { get; set; }

// /// <summary>
// ///
// /// </summary>
// public int myField;

// /// <summary>
// ///
// /// </summary>
// public void MyMethod()
// {

// }

// /// <summary>
// ///
// /// </summary>
// /// <typeparam name="T"></typeparam>
// /// <param name="y"></param>
// /// <returns></returns>
// public int MyMethodT<T>(double y)
// {
// _ = y;
// return 0;
// }

// /// <summary>
// ///
// /// </summary>
// /// <param name="a"></param>
// /// <param name="b"></param>
// public record MyRecord(int a, int b);

// /// <summary>
// ///
// /// </summary>
// public enum MyEnum
// {
// /// <summary>
// ///
// /// </summary>
// MyValue1
// }
//}
Loading
0