Conversation
| Contract.ThrowIfNull(TypeToGenerateIn); | ||
| var typeParametersNames = TypeToGenerateIn.GetAllTypeParameters().Select(t => t.Name).ToImmutableArray(); | ||
| var typeParametersNames = TypeToGenerateIn.GetAllTypeParameters().SelectAsArray(t => t.Name); | ||
| var parameterNames = GetParameterNames(_arguments, typeParametersNames, cancellationToken); |
There was a problem hiding this comment.
Select+ToImmutableArray becomes SelectAsArray.
| .GroupBy(diagnostic => diagnostic.Location.SourceTree) | ||
| .Where(group => group.Key is not null) | ||
| .SelectAsArray(group => (id: solution.GetRequiredDocument(group.Key!).Id, diagnostics: group.ToImmutableArray())); | ||
| .SelectAsArray(group => group.Key is not null, group => (id: solution.GetRequiredDocument(group.Key!).Id, diagnostics: group.ToImmutableArray())); |
There was a problem hiding this comment.
Where+SelectAsArray becomes SelectAsArray (with predicate passed to the latter).
|
|
||
| builder = ArrayBuilder<TResult>.GetInstance(); | ||
| return true; | ||
| } |
There was a problem hiding this comment.
optimized a bunch of these helpers if the count can be determined (fast path to returning empty array, and also properly sizing the dest buffer).
| .Select(p => semanticModel.GetRequiredDeclaredSymbol(p, cancellationToken)) | ||
| .Where(p => p.RefKind == RefKind.Out) | ||
| .ToImmutableArray(); | ||
| .WhereAsArray(p => p.RefKind == RefKind.Out); |
There was a problem hiding this comment.
Where+ToImmutableArray becomes WhereAsArray
| @@ -349,25 +377,34 @@ public static T[] AsArray<T>(this IEnumerable<T> source) | |||
|
|
|||
| public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, TResult> selector) | |||
There was a problem hiding this comment.
Extensions that work on null receiver are odd.
There was a problem hiding this comment.
don't disagree. however, a lot of collect/ienumrable methods do this. so this is keeping things mostly consistent. would prefer to not rock the boat there for now.
src/Features/Core/Portable/SignatureHelp/SignatureHelpService.cs
Outdated
Show resolved
Hide resolved
...t.CodeAnalysis.LanguageServer/HostWorkspace/ProjectTelemetry/ProjectLoadTelemetryReporter.cs
Show resolved
Hide resolved
|
@tmat ptal. |
| } | ||
|
|
||
| #if NET | ||
| if (source.TryGetNonEnumeratedCount(out var count)) |
There was a problem hiding this comment.
Can we reasonably optimize further if the count is < 4, using TemporaryArray?
There was a problem hiding this comment.
That seems hard to do in a generalized fashion.
There was a problem hiding this comment.
or, put another way. can i postpone that till later. i'd rather get this in and focus on other stuff for now.
No description provided.