IEnumerable <FoldingRegion> GenerateFoldingsInternal(IReadOnlyList <Comment> comments, CancellationToken cancellationToken)
        {
            if (cancellationToken.IsCancellationRequested)
            {
                yield break;
            }

            foreach (var fold in comments.ToFolds())
            {
                yield return(fold);
            }

            if (cancellationToken.IsCancellationRequested)
            {
                yield break;
            }

            var visitor = new FoldingVisitor(cancellationToken);

            if (Unit != null)
            {
                try {
                    visitor.Visit(Unit.GetRoot(cancellationToken));
                } catch (Exception) { }
            }

            if (cancellationToken.IsCancellationRequested)
            {
                yield break;
            }
            foreach (var fold in visitor.Foldings)
            {
                yield return(fold);
            }
        }
示例#2
0
        IEnumerable <FoldingRegion> GenerateFoldings(CancellationToken cancellationToken)
        {
            foreach (var fold in GetCommentsAsync().Result.ToFolds())
            {
                yield return(fold);
            }

            var visitor = new FoldingVisitor(cancellationToken);

            if (Unit != null)
            {
                try {
                    visitor.Visit(Unit.GetRoot(cancellationToken));
                } catch (Exception) { }
            }
            foreach (var fold in visitor.Foldings)
            {
                yield return(fold);
            }
        }
		IEnumerable<FoldingRegion> GenerateFoldings (CancellationToken cancellationToken)
		{
			foreach (var fold in GetCommentsAsync().Result.ToFolds ())
				yield return fold;

			var visitor = new FoldingVisitor (cancellationToken);
			if (Unit != null) {
				try {
					visitor.Visit (Unit.GetRoot (cancellationToken));
				} catch (Exception) { }
			}
			foreach (var fold in visitor.Foldings)
				yield return fold;
		}
		IEnumerable<FoldingRegion> GenerateFoldingsInternal (IReadOnlyList<Comment> comments, CancellationToken cancellationToken)
		{
			foreach (var fold in comments.ToFolds ())
				yield return fold;

			var visitor = new FoldingVisitor (cancellationToken);
			if (Unit != null) {
				try {
					visitor.Visit (Unit.GetRoot (cancellationToken));
				} catch (Exception) { }
			}
			foreach (var fold in visitor.Foldings)
				yield return fold;
		}