public override SyntaxNode Visit(SyntaxNode node) { _cancellationToken.ThrowIfCancellationRequested(); if (node == null || !_spans.HasIntervalThatIntersectsWith(node.FullSpan)) { return(node); } return(base.Visit(node)); }
private IList <TextChange> CreateTextChanges(CancellationToken cancellationToken) { using (Logger.LogBlock(FunctionId.Formatting_AggregateCreateTextChanges, cancellationToken)) { // quick check var changes = CreateTextChangesWorker(cancellationToken); // formatted spans and formatting spans are different, filter returns to formatting span return(_formattingSpans == null ? changes : changes.Where(s => _formattingSpans.HasIntervalThatIntersectsWith(s.Span)).ToList()); } }
/// <summary> /// check whether the given span is intersects with the tree /// </summary> public static bool HasIntervalThatIntersectsWith( this SimpleIntervalTree <TextSpan, TextSpanIntervalIntrospector> tree, TextSpan span ) => tree.HasIntervalThatIntersectsWith(span.Start, span.Length);