Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -1129,4 +1129,52 @@ await VerifyItemIsAbsentAsync("""
"see",
deletedCharTrigger: 'b');
}

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/78770")]
public Task ExtensionBlock_01()
=> VerifyItemsExistAsync("""
public static class E
{
/// $$
extension<T>(int i) { }
}
""", """
typeparam name="T"
""", """
param name="i"
""",
"summary");

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/78770")]
public Task ExtensionBlock_02()
=> VerifyItemsExistAsync("""
public static class E
{
/// <summary> $$ </summary>
extension<T>(int i)
{
}
}
""", """
paramref name="i"
""", """
typeparamref name="T"
""");

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/78770")]
public Task ExtensionBlock_03()
=> VerifyItemsExistAsync("""
public static class E
{
extension<T>(int i)
{
/// <summary> $$ </summary>
void M() { }
}
}
""", """
paramref name="i"
""", """
typeparamref name="T"
""");
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,26 @@ class C
}
""");

[WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/78770")]
public void TypingCharacter_Extension()
=> VerifyTypingCharacter("""
static class C
{
//$$
extension<T>(int i) { }
}
""", """
static class C
{
/// <summary>
/// $$
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="i"></param>
extension<T>(int i) { }
}
""");

[WpfFact]
public void TypingCharacter_Record()
=> VerifyTypingCharacter("""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,10 @@ protected override ImmutableArray<IParameterSymbol> GetParameters(ISymbol declar
{
declaredParameters = delegateInvokeParameters;
}
else if (namedTypeSymbol.IsExtension && namedTypeSymbol.ExtensionParameter is { } extensionParameter)
{
declaredParameters = [extensionParameter];
}
}

return declaredParameters;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ protected override bool SupportsDocumentationComments(MemberDeclarationSyntax me
case SyntaxKind.EventFieldDeclaration:
case SyntaxKind.OperatorDeclaration:
case SyntaxKind.ConversionOperatorDeclaration:
case SyntaxKind.ExtensionBlockDeclaration:
return true;

default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Text;
Expand Down Expand Up @@ -150,6 +151,11 @@ protected IEnumerable<CompletionItem> GetNestedItems(ISymbol? symbol, bool inclu
.Concat(GetTypeParamRefItems(symbol));
}

if (symbol is { ContainingSymbol: INamedTypeSymbol { IsExtension: true } extension })
{
items = items.Concat(GetParamRefItems(extension));
}

if (includeKeywords)
{
items = items.Concat(GetKeywordNames().Select(CreateLangwordCompletionItem));
Expand Down
Loading