private IEnumerable<Diagnostic> CreateFixableDiagnostics(IEnumerable<SyntaxNode> nodes, SyntaxTree tree, CancellationToken cancellationToken = default(CancellationToken)) { var spans = GetFixableDiagnosticSpans(nodes, tree, cancellationToken); foreach (var span in spans) { yield return Diagnostic.Create(GetClassificationIdDescriptor(), tree.GetLocation(span)); } }
// Create one diagnostic for each unnecessary span that will be classified as Unnecessary private IEnumerable<Diagnostic> CreateClassificationDiagnostics(IEnumerable<TextSpan> contiguousSpans, SyntaxTree tree, CancellationToken cancellationToken = default(CancellationToken)) { foreach (var span in contiguousSpans) { if (tree.OverlapsHiddenPosition(span, cancellationToken)) { continue; } yield return Diagnostic.Create(GetClassificationIdDescriptor(), tree.GetLocation(span)); } }