private SpellingIssue IdentifyIssues(string word, IDocument document, SyntaxToken identifier, CommonSyntaxNode node, ParallelLoopState state, SpellingIssue dummy) { bool found = WordLookupService.SearchExact(word.ToLower()); if (found) return (SpellingIssue)null; var suggestions = WordLookupService.Search(word.ToLower()) .Select(m => char.IsUpper(identifier.ValueText[0]) ? (char.ToUpper(m[0]) + m.Substring(1)) : m) .ToList(); var actions = new List<ICodeAction>(); foreach (var suggestion in suggestions) { actions.Add(new FixSpellingCodeAction(document, node, identifier.ValueText, identifier.ValueText.Replace(word, suggestion))); } var spanStart = identifier.Span.Start + identifier.ValueText.IndexOf(word, StringComparison.InvariantCultureIgnoreCase); var span = new TextSpan(spanStart, word.Length); return new SpellingIssue(span, word, actions); }
private SpellingIssue IdentifyIssues(string word, IDocument document, SyntaxToken identifier, CommonSyntaxNode node, ParallelLoopState state, SpellingIssue dummy) { bool found = WordLookupService.SearchExact(word.ToLower()); if (found) { return((SpellingIssue)null); } var suggestions = WordLookupService.Search(word.ToLower()) .Select(m => char.IsUpper(identifier.ValueText[0]) ? (char.ToUpper(m[0]) + m.Substring(1)) : m) .ToList(); var actions = new List <ICodeAction>(); foreach (var suggestion in suggestions) { actions.Add(new FixSpellingCodeAction(document, node, identifier.ValueText, identifier.ValueText.Replace(word, suggestion))); } var spanStart = identifier.Span.Start + identifier.ValueText.IndexOf(word, StringComparison.InvariantCultureIgnoreCase); var span = new TextSpan(spanStart, word.Length); return(new SpellingIssue(span, word, actions)); }