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); } }
public IEnumerable <ITagSpan <IOutliningRegionTag> > GetTags(NormalizedSnapshotSpanCollection spans) { if (spans.Count == 0) { yield break; } ITextSnapshot currentSnapshot = this.snapshot; SQDeclaration sqdec = _languangeService.Parse(currentSnapshot.TextBuffer); List <TextSpan> textspans = new List <TextSpan>(); GetSpans(textspans, sqdec); foreach (var scope in textspans) { var startLine = currentSnapshot.GetLineFromLineNumber(scope.iStartLine); var endLine = currentSnapshot.GetLineFromLineNumber(scope.iEndLine); var start = startLine.Start + scope.iStartIndex; int length = (endLine.Start - startLine.Start) + scope.iEndIndex - scope.iStartIndex; if (length > 0) { yield return(new TagSpan <IOutliningRegionTag>( new SnapshotSpan(start, length), new OutliningRegionTag(false, false, ellipsis, hoverText))); } } }
void GetSpans(List <TextSpan> spans, SQDeclaration parent) { if (parent.Type == SQDeclarationType.Class || parent.Type == SQDeclarationType.Function || parent.Type == SQDeclarationType.Scope) { spans.Add(parent.ScopeSpan); } foreach (var child in parent.Children) { GetSpans(spans, child.Value); } }
private void url_MouseDown(object sender, MouseButtonEventArgs e) { TextBlock block = sender as TextBlock; SQDeclaration d = block.Tag as SQDeclaration; if (d != null) { SQVSUtils.OpenDocumentInNewWindow(d.Url, presenter.serviceProvider, d.Span.iStartLine); } /*if(Dispatcher.CheckAccess()) * { * SQVSUtils.OpenDocumentInNewWindow(d.Url, presenter.serviceProvider, d.Span.iStartLine); * } * else * { * Dispatcher.BeginInvoke((Action)delegate () * { * SQVSUtils.OpenDocumentInNewWindow(d.Url, presenter.serviceProvider, d.Span.iStartLine); * }); * }*/ }