Ejemplo n.º 1
0
            private void AnalyzeSyntaxTree(SyntaxTreeAnalysisContext context)
            {
                SyntaxTree tree = context.Tree;

                SyntaxNode root = tree.GetRoot(context.CancellationToken);

                var analysisContext = new SpellingAnalysisContext(
                    diagnostic => context.ReportDiagnostic(diagnostic),
                    _spellingData,
                    _options,
                    context.CancellationToken);

                CSharpSpellingWalker walker = CSharpSpellingWalker.Create(analysisContext);

                walker.Visit(root);
            }
Ejemplo n.º 2
0
        public override ImmutableArray <Diagnostic> AnalyzeSpelling(
            SyntaxNode node,
            SpellingData spellingData,
            SpellingFixerOptions options,
            CancellationToken cancellationToken = default)
        {
            var diagnostics = new List <Diagnostic>();

            var analysisContext = new SpellingAnalysisContext(
                diagnostic => diagnostics.Add(diagnostic),
                spellingData,
                options,
                cancellationToken);

            CSharpSpellingWalker walker = CSharpSpellingWalker.Create(analysisContext);

            walker.Visit(node);

            return(diagnostics.ToImmutableArray());
        }