|
7 | 7 | using System.Collections.Immutable; |
8 | 8 | using System.Threading; |
9 | 9 | using System.Threading.Tasks; |
| 10 | +using Microsoft.CodeAnalysis.Shared.Collections; |
10 | 11 | using Roslyn.Utilities; |
11 | 12 |
|
12 | 13 | namespace Microsoft.CodeAnalysis.FindSymbols.Finders; |
@@ -58,23 +59,21 @@ protected sealed override Task DetermineDocumentsToSearchAsync<TData>( |
58 | 59 | // document, and their containing type name ("Program") doesn't have to appear there at all. |
59 | 60 |
|
60 | 61 | Contract.ThrowIfNull(symbol.DeclaringMethod); |
61 | | - if (symbol is |
| 62 | + |
| 63 | + using var names = TemporaryArray<string>.Empty; |
| 64 | + names.Add(symbol.Name); |
| 65 | + names.Add(GetMemberNameWithoutInterfaceName(symbol.DeclaringMethod.Name)); |
| 66 | + |
| 67 | + if (symbol is not |
62 | 68 | { |
63 | 69 | ContainingSymbol: IMethodSymbol { MethodKind: MethodKind.LocalFunction }, |
64 | 70 | ContainingType: INamedTypeSymbol { Name: "Program", ContainingNamespace.IsGlobalNamespace: true } |
65 | 71 | }) |
66 | 72 | { |
67 | | - return FindDocumentsAsync(project, documents, processResult, processResultData, cancellationToken, |
68 | | - symbol.Name, |
69 | | - GetMemberNameWithoutInterfaceName(symbol.DeclaringMethod.Name)); |
70 | | - } |
71 | | - else |
72 | | - { |
73 | | - return FindDocumentsAsync(project, documents, processResult, processResultData, cancellationToken, |
74 | | - symbol.Name, |
75 | | - GetMemberNameWithoutInterfaceName(symbol.DeclaringMethod.Name), |
76 | | - symbol.DeclaringMethod.ContainingType.Name); |
| 73 | + names.Add(symbol.ContainingType.Name); |
77 | 74 | } |
| 75 | + |
| 76 | + return FindDocumentsAsync(project, documents, processResult, processResultData, cancellationToken, names.ToImmutableAndClear()); |
78 | 77 | } |
79 | 78 |
|
80 | 79 | private static string GetMemberNameWithoutInterfaceName(string fullName) |
|
0 commit comments