private static void AnalyzeIfEnabled <TContext>( TCodeStyleProvider provider, TContext context, Action <TContext, CodeStyleOption <TOptionKind> > analyze, AnalyzerOptions options, SyntaxTree syntaxTree, CancellationToken cancellationToken) { var optionSet = options.GetDocumentOptionSetAsync(syntaxTree, cancellationToken).GetAwaiter().GetResult(); if (optionSet == null) { return; } var optionValue = optionSet.GetOption(provider._option); var severity = GetOptionSeverity(optionValue); switch (severity) { case ReportDiagnostic.Error: case ReportDiagnostic.Warn: case ReportDiagnostic.Info: break; default: // don't analyze if it's any other value. return; } analyze(context, optionValue); }
public AnalysisContext( TCodeStyleProvider codeStyleProvider, Diagnostics.AnalysisContext context ) { _codeStyleProvider = codeStyleProvider; _context = context; }
private DiagnosticAnalyzer(TCodeStyleProvider codeStyleProvider, bool configurable) : base(codeStyleProvider._descriptorId, codeStyleProvider._option, codeStyleProvider._language, codeStyleProvider._title, codeStyleProvider._message, configurable) { _codeStyleProvider = codeStyleProvider; }
private static void AnalyzeIfEnabled <TContext>( TCodeStyleProvider provider, TContext context, Action <TContext, CodeStyleOption2 <TOptionValue> > analyze, AnalyzerOptions analyzerOptions, SyntaxTree syntaxTree) { var optionValue = provider.GetCodeStyleOption(analyzerOptions.GetAnalyzerOptions(syntaxTree)); var severity = GetOptionSeverity(optionValue); switch (severity) { case ReportDiagnostic.Error: case ReportDiagnostic.Warn: case ReportDiagnostic.Info: break; default: // don't analyze if it's any other value. return; } analyze(context, optionValue); }
protected CodeFixProvider() { _codeStyleProvider = new TCodeStyleProvider(); FixableDiagnosticIds = ImmutableArray.Create(_codeStyleProvider._descriptorId); }
protected CodeRefactoringProvider() { _codeStyleProvider = new TCodeStyleProvider(); }