protected override IEnumerable <SimpleDothtmlCompletion> GetItemsCore(DothtmlCompletionContext context, string directiveName)
        {
            if (string.Equals(directiveName, Constants.ViewModelDirectiveName, StringComparison.InvariantCultureIgnoreCase) ||
                string.Equals(directiveName, Constants.BaseTypeDirective, StringComparison.InvariantCultureIgnoreCase))
            {
                // get icons for intellisense
                var classGlyph     = context.GlyphService.GetGlyph(StandardGlyphGroup.GlyphGroupClass, StandardGlyphItem.GlyphItemPublic);
                var interfaceGlyph = context.GlyphService.GetGlyph(StandardGlyphGroup.GlyphGroupInterface, StandardGlyphItem.GlyphItemPublic);
                var nameFilter     = string.Empty;

                var currentToken = context.Tokens[context.CurrentTokenIndex];
                if (currentToken.Type == DothtmlTokenType.DirectiveValue)
                {
                    var currentPosition = context.CompletionSession.TextView.Caret.Position.BufferPosition.Position;
                    if (currentPosition != currentToken.StartPosition)
                    {
                        nameFilter = string.Concat(currentToken.Text.Take(currentPosition - currentToken.StartPosition));
                    }
                }

                // get list of all custom types
                var types = typeNames.GetOrRetrieve(() =>
                {
                    return(CompletionHelper.GetSyntaxTrees(context)
                           .SelectMany(i => i.Tree.GetRoot().DescendantNodes().OfType <TypeDeclarationSyntax>()
                                       .Select(n => new { Symbol = i.SemanticModel.GetDeclaredSymbol(n), Compilation = i.Compilation, Node = n })
                                       .Where(n => n.Symbol != null))
                           .Select(t => new CompletionDataWithGlyph()
                    {
                        CompletionData = new CompletionData(
                            $"{t.Symbol.Name} (in namespace {t.Symbol.ContainingNamespace})",
                            t.Symbol.ToString() + ", " + t.Compilation.AssemblyName),
                        Glyph = t.Node is ClassDeclarationSyntax ? classGlyph : interfaceGlyph,
                        Name = t.Symbol.Name,
                        Namespace = t.Symbol.ContainingNamespace.ToString()
                    })
                           .ToList());
                });

                if (!string.IsNullOrWhiteSpace(nameFilter))
                {
                    types = types.Where(w =>
                                        w.Name.StartsWith(nameFilter, StringComparison.OrdinalIgnoreCase) ||
                                        ($"{w.Namespace}.{w.Name}").StartsWith(nameFilter, StringComparison.OrdinalIgnoreCase)).ToList();
                }

                // return completion items
                return(types.Select(t => new[]
                {
                    new SimpleDothtmlCompletion(t.CompletionData.DisplayText, t.CompletionData.CompletionText, t.Glyph),
                    new SimpleDothtmlCompletion(t.CompletionData.CompletionText, t.CompletionData.CompletionText, t.Glyph)
                })
                       .SelectMany(sm => sm));
            }
            else
            {
                return(Enumerable.Empty <SimpleDothtmlCompletion>());
            }
        }
 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();
     }));
 }