Exemplo n.º 1
0
        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)
            {
                foreach (var newSpanData in GetReferenceInfosFrom(spanData.Value.Span.Start, forward))
                {
                    if (SpanDataReferenceInfoExtensions.CompareReferences(newSpanData.Data, spanData.Value.Data))
                    {
                        MoveCaretToSpan(newSpanData.Span);
                        break;
                    }
                }
                return;
            }
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        SpanData <ReferenceAndId>?GetCurrentSpanReference()
        {
            if (documentViewer == null)
            {
                return(null);
            }
            var spanData = SpanDataCollectionUtilities.GetCurrentSpanReference(spanReferenceCollection, documentViewer.TextView);

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