public static TextExtent GetExtent(this SnapshotPoint snapshotPoint) { var startPoint = snapshotPoint; SnapshotPoint endPoint; while (startPoint > 0) { endPoint = startPoint - 1; if (endPoint.IsSuitableChar()) { startPoint = endPoint; } else { break; } } endPoint = snapshotPoint; while (endPoint < snapshotPoint.Snapshot.Length - 1) { if (endPoint.IsSuitableChar()) { endPoint += 1; } else { break; } } return(new TextExtent(new SnapshotSpan(startPoint, endPoint), (endPoint - startPoint) > 0)); }