public IEnumerable <JSONCompletionEntry> GetListEntries(JSONCompletionContext context) { JSONMember member = context.ContextItem as JSONMember; if (member == null || member.Name == null || member.Name.Text != "\"@context\"") { yield break; } var vocabularies = VocabularyFactory.GetAllVocabularies(); foreach (IVocabulary vocabulary in vocabularies) { yield return(new JSONCompletionEntry(vocabulary.DisplayName, "\"" + vocabulary.DisplayName + "\"", null, GlyphService.GetGlyph(StandardGlyphGroup.GlyphGroupVariable, StandardGlyphItem.GlyphItemPublic), "iconAutomationText", true, context.Session as ICompletionSession)); } }
public IEnumerable <JSONCompletionEntry> GetListEntries(JSONCompletionContext context) { JSONMember member = context.ContextItem as JSONMember; if (member == null || member.Name == null || member.Name.Text != "\"@type\"") { yield break; } foreach (IVocabulary vocabulary in VocabularyFactory.GetVocabularies(member)) { foreach (string key in vocabulary.Cache.Keys) { yield return(new JSONCompletionEntry(key, "\"" + key + "\"", null, GlyphService.GetGlyph(StandardGlyphGroup.GlyphGroupVariable, StandardGlyphItem.GlyphItemPublic), "iconAutomationText", true, context.Session as ICompletionSession)); } } }
public IEnumerable <JSONCompletionEntry> GetListEntries(JSONCompletionContext context) { JSONMember member = context.ContextItem as JSONMember; if (member == null || member.Name == null) { yield break; } var vocabularies = VocabularyFactory.GetVocabularies(member); if (!vocabularies.Any()) { yield break; } JSONBlockItem block = member.FindType <JSONBlockItem>(); var visitor = new JSONItemCollector <JSONMember>(); block.Accept(visitor); JSONMember ldType = visitor.Items.FirstOrDefault(m => m.Name != null && m.Value != null && m.Name.Text == "\"@type\""); if (ldType == null) { yield break; } string value = ldType.Value.Text.Trim('"'); foreach (IVocabulary vocab in vocabularies.Where(v => v.Cache.ContainsKey(value))) { foreach (Entry entry in vocab.Cache[value]) { yield return(new JSONCompletionEntry(entry.Name, "\"" + entry.Name + "\"", null, entry.Glyph, "iconAutomationText", true, context.Session as ICompletionSession)); } } }