void FindSpellingMistakesInXmlTextSyntax(XmlTextSyntax node) { var allText = node.ToString(); var lineTextSpans = CommentTextExtractor.LocateMultiLineCommentTextParts(allText); foreach (var lineTextSpan in lineTextSpans) { var lineText = allText.Substring(lineTextSpan.Start, lineTextSpan.Length); var wordParts = GeneralTextParser.SplitWordParts(lineText); foreach (var part in wordParts) { if (ShouldWordBeMarkedAsMisspelled(part)) { var location = Location.Create(node.SyntaxTree, new TextSpan(node.SpanStart + lineTextSpan.Start + part.Start, part.Length)); HandleMistake(location, part.Text, SpellingMistakeKind.Documentation); } } } }
void FindSpellingMistakesInSingleLineComment(SyntaxTrivia node) { var lineText = node.ToString(); var textSpan = CommentTextExtractor.LocateSingleLineCommentText(lineText); if (textSpan.Length == 0) { return; } var parts = GeneralTextParser.SplitWordParts(lineText.Substring(textSpan.Start, textSpan.Length)); foreach (var part in parts) { if (ShouldWordBeMarkedAsMisspelled(part)) { var location = Location.Create(node.SyntaxTree, new TextSpan(node.SpanStart + textSpan.Start + part.Start, part.Length)); HandleMistake(location, part.Text, SpellingMistakeKind.Comment); } } }
public override void VisitInterpolatedStringText(InterpolatedStringTextSyntax node) { var token = node.TextToken; var valueText = token.ValueText; var syntaxText = token.Text; var valueLocator = new StringLiteralSyntaxCharValueLocator(valueText, syntaxText, token.IsVerbatimStringLiteral()); var parts = GeneralTextParser.SplitWordParts(valueText); foreach (var part in parts) { if (ShouldWordBeMarkedAsMisspelled(part)) { var spanOffset = valueLocator.ConvertValueToSyntaxIndex(part.Start); var location = Location.Create(token.SyntaxTree, new TextSpan(token.SpanStart + spanOffset, part.Length)); HandleMistake(location, part.Text, SpellingMistakeKind.Literal); } } base.VisitInterpolatedStringText(node); }