public IPromise <IEnumerable <ICompletionData> > GetPromise(IEnumerable <ICompletionData> buffer = null)
 {
     buffer = buffer ?? Enumerable.Empty <ICompletionData>();
     return(_metadata.GetProperties(_itemType)
            .Convert(p => GetCompletions(p.Where(Filter)).Concat(buffer)));
 }
        private async Task <bool> Navigate(DocumentUrl documentUrl)
        {
            SetMessage("Loading...");
            try
            {
                UpdateAddressBar(documentUrl);

                var options = new Documentation.DocumentOptions();
                switch (documentUrl.Category.ToUpperInvariant())
                {
                case "HELP":
                    if (_topics.TryGetValue(documentUrl.Name, out var generator))
                    {
                        _document = null;
                        Display(generator());
                        return(true);
                    }
                    break;

                case "ITEMTYPE":
                    await _metadata.ReloadTask();

                    if (_metadata.ItemTypeByName(documentUrl.Name, out var itemType))
                    {
                        await Task.WhenAll(_metadata.GetClassPaths(itemType).ToTask(), _metadata.GetProperties(itemType).ToTask());

                        Display(Documentation.Document.FromItemType(itemType, options));
                        return(true);
                    }
                    break;

                case "METHOD":
                    await _metadata.ReloadTask();

                    var method = _metadata.Methods.FirstOrDefault(m => string.Equals(m.KeyedName, documentUrl.Name, StringComparison.OrdinalIgnoreCase));
                    if (method != null)
                    {
                        Display(Documentation.Document.FromMethod(method, options));
                        return(true);
                    }
                    break;
                }
                SetMessage("Can't load document");
            }
            catch (Exception ex)
            {
                SetMessage("Can't load document\r\n" + ex.ToString());
            }

            return(false);
        }