// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Generic; using System.Linq; using Microsoft.AspNetCore.Razor.Language; namespace Microsoft.CodeAnalysis.Razor { public abstract class AttributeCompletionResult { private AttributeCompletionResult() { } public abstract IReadOnlyDictionary> Completions { get; } internal static AttributeCompletionResult Create(Dictionary> completions) { var readonlyCompletions = completions.ToDictionary( key => key.Key, value => (IEnumerable)value.Value, completions.Comparer); var result = new DefaultAttributeCompletionResult(readonlyCompletions); return result; } private class DefaultAttributeCompletionResult : AttributeCompletionResult { private readonly IReadOnlyDictionary> _completions; public DefaultAttributeCompletionResult(IReadOnlyDictionary> completions) { _completions = completions; } public override IReadOnlyDictionary> Completions => _completions; } } }