Example #1
0
        internal IList <IAnchor> GetValue(ITextSnapshot snapshot, ParserDataOptions options)
        {
            if (_textBuffer != snapshot.TextBuffer)
            {
                throw new ArgumentException();
            }

            // reference anchors never change
            IList <IAnchor> result;

            if (_referenceAnchors.TryGetValue(snapshot, out result))
            {
                return(result);
            }

            if ((options & ParserDataOptions.AllowStale) != ParserDataOptions.None)
            {
                var newestResult = _newestResult;
                if (newestResult != null)
                {
                    return(newestResult.Item2);
                }
            }

            if ((options & ParserDataOptions.NoUpdate) != ParserDataOptions.None)
            {
                return(null);
            }

            // calculate the results...
            result = _referenceAnchors.GetValue(snapshot, key => CreateReferenceAnchorPoints(key, null));
            return(result);
        }
        public IList<IAnchor> GetValue(ITextSnapshot snapshot, ParserDataOptions options)
        {
            if (_textBuffer != snapshot.TextBuffer)
                throw new ArgumentException();

            Antlr4ReferenceAnchorPoints referenceAnchorPoints = _provider.ReferenceAnchorPointsProvider.GetReferenceAnchorPoints(_textBuffer);
            if (referenceAnchorPoints == null)
                return new IAnchor[0];

            IList<IAnchor> referenceAnchors = referenceAnchorPoints.GetValue(snapshot, ParserDataOptions.AllowStale);
            return referenceAnchors;
        }
Example #3
0
        public IList <IAnchor> GetValue(ITextSnapshot snapshot, ParserDataOptions options)
        {
            if (_textBuffer != snapshot.TextBuffer)
            {
                throw new ArgumentException();
            }

            Antlr4ReferenceAnchorPoints referenceAnchorPoints = _provider.ReferenceAnchorPointsProvider.GetReferenceAnchorPoints(_textBuffer);

            if (referenceAnchorPoints == null)
            {
                return(new IAnchor[0]);
            }

            IList <IAnchor> referenceAnchors = referenceAnchorPoints.GetValue(snapshot, ParserDataOptions.AllowStale);

            return(referenceAnchors);
        }
        internal IList<IAnchor> GetValue(ITextSnapshot snapshot, ParserDataOptions options)
        {
            if (_textBuffer != snapshot.TextBuffer)
                throw new ArgumentException();

            // reference anchors never change
            IList<IAnchor> result;
            if (_referenceAnchors.TryGetValue(snapshot, out result))
                return result;

            if ((options & ParserDataOptions.AllowStale) != ParserDataOptions.None)
            {
                var newestResult = _newestResult;
                if (newestResult != null)
                    return newestResult.Item2;
            }

            if ((options & ParserDataOptions.NoUpdate) != ParserDataOptions.None)
                return null;

            // calculate the results...
            result = _referenceAnchors.GetValue(snapshot, key => CreateReferenceAnchorPoints(key, null));
            return result;
        }