private static List <Completion> GetCompletitions(string rule) { if (Completitions.Count == 0) { lock (Completitions) { foreach (var r in SyntaxParser.AllRules) { if (r.Children.Length > 0) { var list = new List <Completion>(); foreach (var c in r.Children) { var nr = SyntaxParser.Find(c); if (nr != null) { list.Add(new Completion( PrettyRuleName(nr.Rule), PrepareStaticGrammar(nr.Grammar), nr.DescriptionAndGrammar, null, null)); } } if (list.Count > 0) { Completitions[r.Rule] = list; } } } } } List <Completion> result; if (Completitions.TryGetValue(rule, out result)) { return(result); } return(null); }
public void AugmentQuickInfoSession( IQuickInfoSession session, IList <object> quickInfoContent, out ITrackingSpan applicableToSpan) { applicableToSpan = null; if (IsDisposed) { return; } var triggerPoint = (SnapshotPoint)session.GetTriggerPoint(Buffer.CurrentSnapshot); if (triggerPoint == null) { return; } foreach (IMappingTagSpan <DddTokenTag> curTag in Aggregator.GetTags(new SnapshotSpan(triggerPoint, triggerPoint))) { var t = curTag.Tag; if (t.Type != DddTokenTypes.Keyword && t.Type != DddTokenTypes.Identifier && t.Type != DddTokenTypes.StringQuote) { continue; } var tagSpan = curTag.Span.GetSpans(Buffer).First(); applicableToSpan = Buffer.CurrentSnapshot.CreateTrackingSpan(tagSpan, SpanTrackingMode.EdgeExclusive); if (t.Parent != null) { var rule = t.Parent.Concept.Value; var found = SyntaxParser.Find(rule); if (found != null) { quickInfoContent.Add(found.DescriptionAndGrammar); } } } }