Example #1
0
        private void AnalyzeSyntaxTree(SyntaxTreeAnalysisContext context)
        {
            if (context.Options is not WorkspaceAnalyzerOptions workspaceAnalyzerOptions)
            {
                return;
            }

            var tree = context.Tree;
            var cancellationToken = context.CancellationToken;
            var optionSet         = context.Options.GetAnalyzerOptionSet(tree, cancellationToken);
            var options           = SyntaxFormattingOptions.Create(optionSet, workspaceAnalyzerOptions.Services, tree.Options.Language);

            FormattingAnalyzerHelper.AnalyzeSyntaxTree(context, workspaceAnalyzerOptions.Services, Descriptor, options);
        }
        private void AnalyzeSyntaxTree(SyntaxTreeAnalysisContext context)
        {
            if (!(context.Options is WorkspaceAnalyzerOptions workspaceAnalyzerOptions))
            {
                return;
            }

            var tree = context.Tree;
            var cancellationToken = context.CancellationToken;

            var options   = context.Options.GetAnalyzerOptionSet(tree, cancellationToken);
            var workspace = workspaceAnalyzerOptions.Services.Workspace;

            FormattingAnalyzerHelper.AnalyzeSyntaxTree(context, workspace, Descriptor, options);
        }
Example #3
0
        private void AnalyzeSyntaxTree(SyntaxTreeAnalysisContext context)
        {
            if (!(context.Options is WorkspaceAnalyzerOptions workspaceAnalyzerOptions))
            {
                return;
            }

            var tree = context.Tree;
            var cancellationToken = context.CancellationToken;

            var options = context.Options.GetDocumentOptionSetAsync(tree, cancellationToken).GetAwaiter().GetResult();

            if (options == null)
            {
                return;
            }

            var workspace = workspaceAnalyzerOptions.Services.Workspace;

            FormattingAnalyzerHelper.AnalyzeSyntaxTree(context, workspace, Descriptor, options);
        }