public IEnumerable <CompletionData> GetElementNames(DothtmlCompletionContext context, List <string> tagNameHierarchy)
        {
            // get all available allControls
            var controls = allControls.GetOrRetrieve(() => ReloadAllControls(context));

            // get element properties
            var                     elementProperties = new List <CompletionData>();
            ControlMetadata         currentControl;
            ControlPropertyMetadata currentProperty;

            GetElementContext(tagNameHierarchy, out currentControl, out currentProperty);
            if (currentControl != null)
            {
                if (currentProperty == null)
                {
                    elementProperties.AddRange(currentControl.Properties.Where(p => p.IsElement).Select(p => new CompletionData(p.Name)));

                    // get default property
                    var defaultContentProperty = currentControl.GetProperty(currentControl.DefaultContentProperty);
                    if (defaultContentProperty != null)
                    {
                        var filteredControls = GetElementNamesInPropertyContext(defaultContentProperty);
                        return(elementProperties.Concat(filteredControls));
                    }
                    else if (!currentControl.AllowContent)
                    {
                        // content is not allowed, return only inner properties
                        return(elementProperties);
                    }
                    else
                    {
                        // content is allowed - return all allControls
                        return(elementProperties.Concat(controls));
                    }
                }
                else
                {
                    return(GetElementNamesInPropertyContext(currentProperty));
                }
            }

            return(controls);
        }
 private List <INamedTypeSymbol> ReloadAllClasses(DothtmlCompletionContext context)
 {
     return(allClasses.GetOrRetrieve(() =>
     {
         var syntaxTrees = CompletionHelper.GetSyntaxTrees(context);
         var ownSymbols = syntaxTrees.SelectMany(t => t.Tree.GetRoot().DescendantNodes().OfType <ClassDeclarationSyntax>()
                                                 .Select(c => t.SemanticModel.GetDeclaredSymbol(c))).ToList();
         var referencedSymbols = CompletionHelper.GetReferencedSymbols(context);
         return Enumerable.Concat(referencedSymbols, ownSymbols).OfType <INamedTypeSymbol>()
         .Where(c => c.DeclaredAccessibility == Accessibility.Public && !c.IsAbstract)
         .ToList();
     }));
 }
 public IEnumerable <CompletionData> GetAttachedPropertyNames(DothtmlCompletionContext context)
 {
     return(attachedProperties.GetOrRetrieve(() => ReloadAllAttachedProperties(context)).Select(a => new CompletionData(a.Name)));
 }