public static async Task <ImmutableArray <Diagnostic> > AnalyzeSpellingAsync( Project project, SpellingData spellingData, SpellingFixerOptions options = null, CancellationToken cancellationToken = default) { ISpellingService service = MefWorkspaceServices.Default.GetService <ISpellingService>(project.Language); if (service == null) { return(ImmutableArray <Diagnostic> .Empty); } ImmutableArray <Diagnostic> .Builder diagnostics = ImmutableArray.CreateBuilder <Diagnostic>(); foreach (Document document in project.Documents) { if (!document.SupportsSyntaxTree) { continue; } ImmutableArray <Diagnostic> diagnostics2 = await AnalyzeSpellingAsync( service, document, spellingData, options, cancellationToken) .ConfigureAwait(false); diagnostics.AddRange(diagnostics2); } return(diagnostics.ToImmutableArray()); }
public SpellingFixer( Solution solution, SpellingData spellingData, IFormatProvider formatProvider = null, SpellingFixerOptions options = null) { Workspace = solution.Workspace; SpellingData = spellingData; FormatProvider = formatProvider; Options = options ?? SpellingFixerOptions.Default; }
public SpellingAnalysisContext( Action <Diagnostic> reportDiagnostic, SpellingData spellingData, SpellingFixerOptions options, CancellationToken cancellationToken) { SpellingData = spellingData; Options = options; CancellationToken = cancellationToken; _reportDiagnostic = reportDiagnostic; _spellchecker = new Spellchecker(spellingData, options: new SpellcheckerOptions(options.SplitMode, options.MinWordLength, options.MaxWordLength)); }
public static async Task <ImmutableArray <Diagnostic> > AnalyzeSpellingAsync( ISpellingService service, Document document, SpellingData spellingData, SpellingFixerOptions options = null, CancellationToken cancellationToken = default) { SyntaxTree tree = await document.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false); if (tree == null) { return(ImmutableArray <Diagnostic> .Empty); } if (!options.IncludeGeneratedCode && GeneratedCodeUtility.IsGeneratedCode(tree, f => service.SyntaxFacts.IsComment(f), cancellationToken)) { return(ImmutableArray <Diagnostic> .Empty); } SyntaxNode root = await tree.GetRootAsync(cancellationToken).ConfigureAwait(false); return(service.AnalyzeSpelling(root, spellingData, options, cancellationToken)); }
public abstract ImmutableArray <Diagnostic> AnalyzeSpelling( SyntaxNode node, SpellingData spellingData, SpellingFixerOptions options, CancellationToken cancellationToken);
public abstract DiagnosticAnalyzer CreateAnalyzer( SpellingData spellingData, SpellingFixerOptions options);