public override void Initialize([NotNull] AnalysisContext context) { context.EnableConcurrentExecution(); context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None); var commentAnalyzer = new TodoCommentAnalyzer(); context.RegisterSyntaxTreeAction(c => commentAnalyzer.AnalyzeTodoComments(c)); }
private void AnalyzeTodoComments(SyntaxTreeAnalysisContext context) { SourceText text = context.Tree.GetText(context.CancellationToken); SyntaxNode root = context.Tree.GetRoot(context.CancellationToken); var analyzer = new TodoCommentAnalyzer(text, context); foreach (SyntaxTrivia trivia in root.DescendantTrivia()) { context.CancellationToken.ThrowIfCancellationRequested(); analyzer.Analyze(trivia); } }