File tree Expand file tree Collapse file tree 5 files changed +79
-0
lines changed
EditorFeatures/CSharpTest
Completion/CompletionProviders
Completion/CompletionProviders
Core/Portable/Completion/Providers Expand file tree Collapse file tree 5 files changed +79
-0
lines changed Original file line number Diff line number Diff line change @@ -1129,4 +1129,52 @@ await VerifyItemIsAbsentAsync("""
11291129 "see" ,
11301130 deletedCharTrigger : 'b' ) ;
11311131 }
1132+
1133+ [ Fact , WorkItem ( "https://github.com/dotnet/roslyn/issues/78770" ) ]
1134+ public Task ExtensionBlock_01 ( )
1135+ => VerifyItemsExistAsync ( """
1136+ public static class E
1137+ {
1138+ /// $$
1139+ extension<T>(int i) { }
1140+ }
1141+ """ , """
1142+ typeparam name="T"
1143+ """ , """
1144+ param name="i"
1145+ """ ,
1146+ "summary" ) ;
1147+
1148+ [ Fact , WorkItem ( "https://github.com/dotnet/roslyn/issues/78770" ) ]
1149+ public Task ExtensionBlock_02 ( )
1150+ => VerifyItemsExistAsync ( """
1151+ public static class E
1152+ {
1153+ /// <summary> $$ </summary>
1154+ extension<T>(int i)
1155+ {
1156+ }
1157+ }
1158+ """ , """
1159+ paramref name="i"
1160+ """ , """
1161+ typeparamref name="T"
1162+ """ ) ;
1163+
1164+ [ Fact , WorkItem ( "https://github.com/dotnet/roslyn/issues/78770" ) ]
1165+ public Task ExtensionBlock_03 ( )
1166+ => VerifyItemsExistAsync ( """
1167+ public static class E
1168+ {
1169+ extension<T>(int i)
1170+ {
1171+ /// <summary> $$ </summary>
1172+ void M() { }
1173+ }
1174+ }
1175+ """ , """
1176+ paramref name="i"
1177+ """ , """
1178+ typeparamref name="T"
1179+ """ ) ;
11321180}
Original file line number Diff line number Diff line change @@ -33,6 +33,26 @@ class C
3333 }
3434 """ ) ;
3535
36+ [ WpfFact , WorkItem ( "https://github.com/dotnet/roslyn/issues/78770" ) ]
37+ public void TypingCharacter_Extension ( )
38+ => VerifyTypingCharacter ( """
39+ static class C
40+ {
41+ //$$
42+ extension<T>(int i) { }
43+ }
44+ """ , """
45+ static class C
46+ {
47+ /// <summary>
48+ /// $$
49+ /// </summary>
50+ /// <typeparam name="T"></typeparam>
51+ /// <param name="i"></param>
52+ extension<T>(int i) { }
53+ }
54+ """ ) ;
55+
3656 [ WpfFact ]
3757 public void TypingCharacter_Record ( )
3858 => VerifyTypingCharacter ( """
Original file line number Diff line number Diff line change @@ -399,6 +399,10 @@ protected override ImmutableArray<IParameterSymbol> GetParameters(ISymbol declar
399399 {
400400 declaredParameters = delegateInvokeParameters ;
401401 }
402+ else if ( namedTypeSymbol . IsExtension && namedTypeSymbol . ExtensionParameter is { } extensionParameter )
403+ {
404+ declaredParameters = [ extensionParameter ] ;
405+ }
402406 }
403407
404408 return declaredParameters ;
Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ protected override bool SupportsDocumentationComments(MemberDeclarationSyntax me
5656 case SyntaxKind . EventFieldDeclaration :
5757 case SyntaxKind . OperatorDeclaration :
5858 case SyntaxKind . ConversionOperatorDeclaration :
59+ case SyntaxKind . ExtensionBlockDeclaration :
5960 return true ;
6061
6162 default :
Original file line number Diff line number Diff line change 88using System . Linq ;
99using System . Threading ;
1010using System . Threading . Tasks ;
11+ using Microsoft . CodeAnalysis . CodeFixes ;
1112using Microsoft . CodeAnalysis . PooledObjects ;
1213using Microsoft . CodeAnalysis . Shared . Extensions ;
1314using Microsoft . CodeAnalysis . Text ;
@@ -150,6 +151,11 @@ protected IEnumerable<CompletionItem> GetNestedItems(ISymbol? symbol, bool inclu
150151 . Concat ( GetTypeParamRefItems ( symbol ) ) ;
151152 }
152153
154+ if ( symbol is { ContainingSymbol : INamedTypeSymbol { IsExtension : true } extension } )
155+ {
156+ items = items . Concat ( GetParamRefItems ( extension ) ) ;
157+ }
158+
153159 if ( includeKeywords )
154160 {
155161 items = items . Concat ( GetKeywordNames ( ) . Select ( CreateLangwordCompletionItem ) ) ;
You can’t perform that action at this time.
0 commit comments