dotnet / docs

This repository contains .NET Documentation.
https://learn.microsoft.com/dotnet
Creative Commons Attribution 4.0 International
4.24k stars 5.89k forks source link

An extension method for AsClauseSyntax API isn't documented #23449

Open Youssef1313 opened 3 years ago

Youssef1313 commented 3 years ago

https://github.com/dotnet/roslyn/blob/91571a3bb038e05e7bf2ab87510273a1017faed0/src/Compilers/VisualBasic/Portable/Syntax/SyntaxExtensions.vb#L48-L63

It's already a public API in roslyn. But the extension methods section doesn't show it.

cc: @gewarren


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Youssef1313 commented 3 years ago

Note that the API is 7-years old :smile:

https://github.com/dotnet/roslyn/blame/91571a3bb038e05e7bf2ab87510273a1017faed0/src/Compilers/VisualBasic/Portable/Syntax/SyntaxExtensions.vb#L48-L63

Also note that MOSTLY ALL extension methods leads to the incorrect link. They redirect to the C# version.

BillWagner commented 3 years ago

cc @jmarolf

I would have thought this would be onboarded with the roslyn-api-docs repo. Any ideas why it's missing?

gewarren commented 3 years ago

Those extension methods do appear in the API docs here: https://review.docs.microsoft.com/en-us/dotnet/api/microsoft.codeanalysis.visualbasic.syntaxextensions?view=roslyn-dotnet&branch=master#methods. They are just not appearing under the Extensions Methods section of the types they extend. I logged an internal bug to look into that.

As to the C# methods like https://review.docs.microsoft.com/en-us/dotnet/api/microsoft.codeanalysis.csharp.csharpextensions.kind?view=roslyn-dotnet&branch=master#Microsoft_CodeAnalysis_CSharp_CSharpExtensions_Kind_Microsoft_CodeAnalysis_SyntaxNode_ being listed, I actually think that is correct according to the signature of that method, because the VB syntax nodes derive from the first parameter type. I'm a bit surprised that the extension method returns a C#-specific type (Microsoft.CodeAnalysis.CSharp.SyntaxKind), but doesn't require that the argument (type it extends) is C#-specific. Any thoughts on that?

public static Microsoft.CodeAnalysis.CSharp.SyntaxKind Kind (this Microsoft.CodeAnalysis.SyntaxNode node);

Also, the corresponding VB-specific method (https://review.docs.microsoft.com/en-us/dotnet/api/microsoft.codeanalysis.visualbasic.visualbasicsyntaxnode.kind?view=roslyn-dotnet&branch=master) is not an extension method, so it wouldn't be listed there under NewExpressionSyntax extension methods.

Youssef1313 commented 3 years ago

Also, the corresponding VB-specific method (https://review.docs.microsoft.com/en-us/dotnet/api/microsoft.codeanalysis.visualbasic.visualbasicsyntaxnode.kind?view=roslyn-dotnet&branch=master) is not an extension method, so it wouldn't be listed there under NewExpressionSyntax extension methods.

There is a Kind extension method.

https://docs.microsoft.com/en-us/dotnet/api/microsoft.codeanalysis.visualbasic.visualbasicextensions.kind?view=roslyn-dotnet#Microsoft_CodeAnalysis_VisualBasic_VisualBasicExtensions_Kind_Microsoft_CodeAnalysis_SyntaxNode_

https://github.com/dotnet/roslyn/blob/91c8cbafb0500d45c36d4586917ca11f0f021285/src/Compilers/VisualBasic/Portable/VisualBasicExtensions.vb#L198-L205