Beispiel #1
0
        public void AugmentQuickInfoSession(IQuickInfoSession session, IList <object> quickInfoContent, out ITrackingSpan applicableToSpan)
        {
            SnapshotPoint?subjectTriggerPoint = session.GetTriggerPoint(_buffer.CurrentSnapshot);

            if (!subjectTriggerPoint.HasValue)
            {
                applicableToSpan = null;
                return;
            }

            var snapshotLine = subjectTriggerPoint.Value.GetContainingLine().LineNumber;


            var triggerPoint = subjectTriggerPoint.Value;


            var lines = _buffer.CurrentSnapshot.Lines.Take(snapshotLine + 1).Select(line => line.GetText()).Reverse().GetEnumerator();

            var hocon = _hoconRetriever.GetHoconObject(lines, subjectTriggerPoint.Value.Position);


            if (!String.IsNullOrEmpty(hocon))
            {
                quickInfoContent.Add(hocon);

                applicableToSpan = subjectTriggerPoint.Value.Snapshot.CreateTrackingSpan(triggerPoint.Position, 5,
                                                                                         SpanTrackingMode.EdgeInclusive);
            }
            else
            {
                applicableToSpan = null;
            }
        }
Beispiel #2
0
        public void When_Getting_Value(string hocon, string path, string expectedResult)
        {
            //Arrange

            IEnumerator <string> enumerator = (new[] { hocon }).AsEnumerable().GetEnumerator();

            var pathConstructorMock = new Mock <IPathConstructor>();

            pathConstructorMock.Setup(
                ctor => ctor.ConstructPathBackwards(enumerator, IRRELEVAENT_INT)).Returns(path);

            var retriever = new HoconRetriever(hocon, pathConstructorMock.Object);

            //Act

            var hoconConfig = retriever.GetHoconObject(enumerator, IRRELEVAENT_INT);

            //Assert

            Assert.That(hoconConfig, Is.EqualTo(expectedResult));
        }