public void CreateForLineNumberRange2()
        {
            Create("hello", "world");
            var range = SnapshotLineRangeUtil.CreateForLineNumberRange(_buffer.CurrentSnapshot, 0, 1);

            Assert.Equal("hello" + Environment.NewLine + "world", range.Extent.GetText());
            Assert.Equal(2, range.Count);
            Assert.Equal(0, range.StartLineNumber);
            Assert.Equal(1, range.LastLineNumber);
        }
Beispiel #2
0
        public void CreateForLineNumberRange1()
        {
            Create("hello", "world");
            var range = SnapshotLineRangeUtil.CreateForLineNumberRange(_buffer.CurrentSnapshot, 0, 0);

            Assert.AreEqual("hello", range.Extent.GetText());
            Assert.AreEqual(1, range.Count);
            Assert.AreEqual(0, range.StartLineNumber);
            Assert.AreEqual(0, range.LastLineNumber);
        }
Beispiel #3
0
 public static SnapshotLineRange GetLineRange(this ITextSnapshot tss, int startLine, int endLine = -1)
 {
     endLine = endLine >= 0 ? endLine : startLine;
     return(SnapshotLineRangeUtil.CreateForLineNumberRange(tss, startLine, endLine));
 }
Beispiel #4
0
 public static SnapshotLineRange GetLineRange(this ITextBuffer buffer, int startLine, int endLine = -1)
 {
     endLine = endLine >= 0 ? endLine : startLine;
     return(SnapshotLineRangeUtil.CreateForLineNumberRange(buffer.CurrentSnapshot, startLine, endLine));
 }