public IReadOnlyCollection <ICompletionEntry> GetEntries(IRIntellisenseContext context)
        {
            var completions = new List <ICompletionEntry>();
            var infoSource  = _snippetInformationSource?.InformationSource;
            var packages    = GetPackages(context).ToList();
            var packageName = packages.Count == 1 ? packages[0].Name : null;

            // Get list of functions in the package
            foreach (var pkg in packages)
            {
                Debug.Assert(pkg != null);
                var functions = pkg.Functions;
                if (functions == null)
                {
                    continue;
                }

                foreach (var function in functions)
                {
                    // Snippets are suppressed if user typed namespace
                    if (!context.IsCaretInNamespace() && infoSource != null)
                    {
                        if (infoSource.IsSnippet(function.Name))
                        {
                            continue;
                        }
                    }
                    var glyph      = function.ItemType == NamedItemType.Constant ? _constantGlyph : _functionGlyph;
                    var completion = new RFunctionCompletionEntry(function.Name, function.Name.BacktickName(), function.Description, glyph, packageName, _functionIndex, context.Session);
                    completions.Add(completion);
                }
            }

            return(completions);
        }
        public async Task <IReadOnlyCollection <ICompletionEntry> > GetEntriesAsync(IRIntellisenseContext context, string prefixFilter = null)
        {
            var completions = new List <ICompletionEntry>();
            var infoSource  = _snippetInformationSource?.InformationSource;
            var packages    = (await GetPackagesAsync(context)).ToList();
            var packageName = packages.Count == 1 ? packages[0].Name : null;

            var caretInNamespace = !context.IsCaretInNamespace(out var showInternalFunctions);

            // Get list of functions in the package
            foreach (var pkg in packages)
            {
                Debug.Assert(pkg != null);
                var functions = pkg.Functions;
                if (functions == null)
                {
                    continue;
                }

                if (!string.IsNullOrEmpty(prefixFilter))
                {
                    functions = functions.Where(f => f.Name.StartsWith(prefixFilter));
                }

                foreach (var function in functions.Where(f => !f.IsInternal || f.IsInternal == showInternalFunctions))
                {
                    // Snippets are suppressed if user typed namespace
                    if (!caretInNamespace && infoSource != null)
                    {
                        if (infoSource.IsSnippet(function.Name))
                        {
                            continue;
                        }
                    }
                    var glyph = function.ItemType == NamedItemType.Constant
                        ? function.IsInternal ? _internalConstantGlyph : _constantGlyph
                        : function.IsInternal ? _internalFunctionGlyph : _functionGlyph;
                    if (function.Name.IndexOf('`') >= 0)
                    {
                    }
                    var completion = new RFunctionCompletionEntry(function.Name.RemoveBackticks(), function.Name.BacktickName(), function.Description, glyph, packageName, _functionIndex, context.Session);
                    completions.Add(completion);
                }
            }

            return(completions);
        }