private List<Completion> GetCompletions(string text, Namespace elements) { var completions = new List<Completion>(); if (elements.Children == null) { completions.Add(new Completion(elements.Description, elements.Description, elements.Description, _glyph, null)); } else { elements.Children.Items.ForEach( child => completions.Add(new Completion(child.Description, child.Description, child.Description, _glyph, null))); } return completions; }
private static Namespace Find(Namespace node, string name) { if (node == null) { return null; } if (node.Alias == name) { return node; } return node.Children == null ? null : node.Children.Items.Select(child => Find(child, name)) .FirstOrDefault(found => found != null); }