public SpellingFixResult( string input, SpellingCapture capture, SpellingFix fix, int?lineNumber = null, string?filePath = null) { Input = input; Capture = capture; Fix = fix; FilePath = filePath; LineNumber = lineNumber; }
protected override List <ICapture>?GetCaptures(List <Capture> groups, CancellationToken cancellationToken) { var captures = new List <ICapture>(); List <TextSpan>?filteredSpans = null; foreach (Capture capture in groups) { foreach (SpellingMatch spellingMatch in SpellcheckState.Spellchecker.AnalyzeText(capture.Value)) { var captureInfo = new SpellingCapture( spellingMatch.Value, capture.Index + spellingMatch.Index, containingValue: spellingMatch.Parent, containingValueIndex: spellingMatch.ParentIndex); if (filteredSpans == null) { filteredSpans = GetFilteredSpans(groups, cancellationToken); } var captureSpan = new TextSpan(captureInfo.Index, captureInfo.Length); foreach (TextSpan filteredSpan in filteredSpans) { if (filteredSpan.IntersectsWith(captureSpan)) { continue; } } captures.Add(captureInfo); } } return(captures); }