Example #1
0
        public void AugmentQuickInfoSession(IQuickInfoSession session, IList <object> quickInfoContent, out ITrackingSpan applicableToSpan)
        {
            applicableToSpan = null;
            // Map the trigger point down to our buffer.
            SnapshotPoint?subjectTriggerPoint = session.GetTriggerPoint(_subjectBuffer.CurrentSnapshot);

            if (!subjectTriggerPoint.HasValue)
            {
                return;
            }

            ITextSnapshot           currentSnapshot = subjectTriggerPoint.Value.Snapshot;
            ITextStructureNavigator navigator       = _provider.NavigatorService.GetTextStructureNavigator(_subjectBuffer);
            TextExtent extent = navigator.GetExtentOfWord(subjectTriggerPoint.Value);

            string key = extent.Span.GetText();
            //look for occurrences of our QuickInfo words in the span
            SQDeclaration dec = _languageService.Find(key);

            if (dec != null)
            {
                quickInfoContent.Add(dec.GetDescription());
                //quickInfoContent.Add(searchText);

                applicableToSpan = currentSnapshot.CreateTrackingSpan(extent.Span.Start, key.Length, SpanTrackingMode.EdgeInclusive);
            }
        }