public SpanData <ReferenceInfo>?GetCurrentReferenceInfo()
        {
            var caretPos = wpfTextViewHost.TextView.Caret.Position;
            var spanData = SpanDataCollectionUtilities.GetCurrentSpanReference(currentContent.Content.ReferenceCollection, wpfTextViewHost.TextView);

            return(spanData?.Data.Reference == null ? null : spanData);
        }
        public void MoveReference(bool forward)
        {
            // Check these references first because if the caret is at a Get declaration (VB), then there's
            // no code references to it, but there's a 'Get' and 'End Get' in these refs that should be used.
            var spanRefData = SpanDataCollectionUtilities.GetCurrentSpanReference(spanReferenceCollection, TextView);

            if (spanRefData?.Data.Reference != null)
            {
                foreach (var newSpanData in GetReferenceInfosFrom(spanReferenceCollection, spanRefData.Value.Span.Start, forward))
                {
                    if (object.Equals(newSpanData.Data.Reference, spanRefData.Value.Data.Reference))
                    {
                        MoveCaretToSpan(newSpanData.Span);
                        break;
                    }
                }
                return;
            }

            var spanData = GetCurrentReferenceInfo();

            if (spanData != null && !spanData.Value.Data.IsHidden)
            {
                foreach (var newSpanData in GetReferenceInfosFrom(spanData.Value.Span.Start, forward))
                {
                    if (!newSpanData.Data.IsHidden && SpanDataReferenceInfoExtensions.CompareReferences(newSpanData.Data, spanData.Value.Data))
                    {
                        MoveCaretToSpan(newSpanData.Span);
                        break;
                    }
                }
                return;
            }
        }
Beispiel #3
0
        SpanData <ReferenceAndId>?GetCurrentSpanReference()
        {
            if (documentViewer is null)
            {
                return(null);
            }
            var spanData = SpanDataCollectionUtilities.GetCurrentSpanReference(spanReferenceCollection, documentViewer.TextView);

            return(spanData?.Data.Reference is null ? null : spanData);
        }