protected bool WordIsIgnored(string word)
 {
     return(String.IsNullOrEmpty(word) ||
            word.Length < MinWordSize ||
            SpellCheckResources.IsIgnoredInsensitive(word) ||
            CStyleFreeTextParser.LooksLikeCodeWord(word));
 }
        protected IEnumerable <HighlightingInfo> FindWordHighlightings(ITreeNode node, string text, DocumentRange textRange)
        {
            var highlights = new List <HighlightingInfo>(0);

            if (WordIsIgnored(text))
            {
                return(highlights);
            }

            var parser    = new CStyleFreeTextParser();
            var wordParts = parser.ParseSentenceWordsForSpellCheck(new TextSubString(text));

            foreach (var wordPart in wordParts)
            {
                var word = wordPart.SubText;

                // Make sure that the word is not to be ignored for any reason.
                if (WordIsIgnored(word))
                {
                    continue;
                }

                // Finally we check the spelling of the word.
                if (SpellCheckResources.SpellChecker.Check(word))
                {
                    continue;
                }

                // If we got this far we need to offer spelling suggestions.
                var wordPartDocumentOffset = textRange.TextRange.StartOffset + wordPart.Offset;
                var wordRange = new DocumentRange(Document, new TextRange(wordPartDocumentOffset, wordPartDocumentOffset + word.Length));
                var highlight = CreateHighlighting(node, wordRange, word, null);
                highlights.Add(new HighlightingInfo(wordRange, highlight));
            }
            return(highlights);
        }