Example #1
0
        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);
                    }
                }
            }
        }
Example #2
0
        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);
                }
            }
        }