Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
genlu committed Feb 2, 2022
1 parent a504005 commit 26c2f4c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -408,9 +408,13 @@ static void AddPropertiesToSession(IAsyncCompletionSession session, CompletionLi
/// calculation cost for cached Roslyn completion items.
/// FilterSetData is the bit vector value from the FilterSet of this item.
/// </summary>
private readonly record struct VSCompletionItemData
(string DisplayText, ImageElement Icon, ImmutableArray<AsyncCompletionData.CompletionFilter> Filters,
int FilterSetData, ImmutableArray<ImageElement> AttributeIcons, string InsertionText);
private readonly record struct VSCompletionItemData(
string DisplayText,
ImageElement Icon,
ImmutableArray<AsyncCompletionData.CompletionFilter> Filters,
int FilterSetData,
ImmutableArray<ImageElement> AttributeIcons,
string InsertionText);

private VSCompletionItem Convert(
Document document,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,11 +407,6 @@ private void AddCompletionItems(List<MatchResult<VSCompletionItem>> list, Cancel

private ImmutableArray<CompletionItemWithHighlight> GetHighlightedList(IReadOnlyList<MatchResult<VSCompletionItem>> items, CancellationToken cancellationToken)
{
if (items.IsEmpty())
{
return ImmutableArray<CompletionItemWithHighlight>.Empty;
}

using var _ = ArrayBuilder<CompletionItemWithHighlight>.GetInstance(items.Count, out var builder);
builder.AddRange(items.Select(matchResult =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private CompletionOptions GetCompletionOptions()
options = options with { ShowItemsFromUnimportedNamespaces = ShowImportCompletionItemsOptionValue.Value };

if (ForceExpandedCompletionIndexCreation.HasValue)
options = options with { ForceExpandedCompletionIndexCreation = true };
options = options with { ForceExpandedCompletionIndexCreation = ForceExpandedCompletionIndexCreation.Value };

if (HideAdvancedMembers.HasValue)
options = options with { HideAdvancedMembers = HideAdvancedMembers.Value };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,17 @@ public abstract partial class CompletionServiceWithProviders
private sealed class ProviderManager : IEqualityComparer<ImmutableHashSet<string>>
{
private readonly object _gate = new();
private readonly Dictionary<string, CompletionProvider?> _nameToProvider = new();
private readonly Dictionary<ImmutableHashSet<string>, ImmutableArray<CompletionProvider>> _rolesToProviders;

private readonly ConditionalWeakTable<IReadOnlyList<AnalyzerReference>, StrongBox<ImmutableArray<CompletionProvider>>> _projectCompletionProvidersMap
= new();

private readonly ConditionalWeakTable<AnalyzerReference, ProjectCompletionProvider> _analyzerReferenceToCompletionProvidersMap
= new();
// Following CWTs are used to cache completion providers from projects' references,
// so we can avoid the slow path unless there's any change to the references.
private readonly ConditionalWeakTable<IReadOnlyList<AnalyzerReference>, StrongBox<ImmutableArray<CompletionProvider>>> _projectCompletionProvidersMap = new();
private readonly ConditionalWeakTable<AnalyzerReference, ProjectCompletionProvider> _analyzerReferenceToCompletionProvidersMap = new();

private readonly ConditionalWeakTable<AnalyzerReference, ProjectCompletionProvider>.CreateValueCallback _createProjectCompletionProvidersProvider
= new(r => new ProjectCompletionProvider(r));

private readonly Dictionary<string, CompletionProvider?> _nameToProvider = new();
private readonly Dictionary<ImmutableHashSet<string>, ImmutableArray<CompletionProvider>> _rolesToProviders;
private readonly Func<ImmutableHashSet<string>, ImmutableArray<CompletionProvider>> _createRoleProviders;
private readonly Func<string, CompletionProvider?> _getProviderByName;

Expand Down

0 comments on commit 26c2f4c

Please sign in to comment.