示例#1
0
        private IEnumerable <IBulbAction> CreateItems()
        {
            var items = new List <IBulbAction>();

            IList <string> replaceFormats = IdentifierResolver.GetReplaceFormats(
                _suggestion.Declaration, _suggestion.Solution, _suggestion.Word);

            foreach (string format in replaceFormats)
            {
                string replacement = String.Format(format, _suggestion.Word);
                items.Add(new ReplaceWordWithBulbItem(_suggestion.DocumentRange, replacement));
            }

            items.Add(new ReplaceWordWithBulbItem(_suggestion.DocumentRange, String.Format("<c>{0}</c>", _suggestion.Word)));

            return(items);
        }
        public void CheckCommentSpelling(
            IClassMemberDeclaration decl,
            IDocCommentBlockNode docNode,
            IHighlightingConsumer highlightingConsumer,
            bool spellCheck)
        {
            if (docNode == null)
            {
                return;
            }

            IFile file = decl.GetContainingFile();

            if (file == null)
            {
                return;
            }

            foreach (Range wordRange in this.GetWordsFromXmlComment(docNode))
            {
                DocumentRange range = file.GetDocumentRange(wordRange.TreeTextRange);
                string        word  = wordRange.Word;

                if (decl.DeclaredName != word)
                {
                    if ((IdentifierResolver.IsIdentifier(decl, _solution, word, _identifierSettings.IdentifierLookupScope) ||
                         IdentifierResolver.IsKeyword(decl, _solution, word)) &&
                        IdentifierResolver.AnalyzeForMetaTagging(word, _xmlDocumentationSettings.CompiledWordsToIgnoreForMetatagging))
                    {
                        var highlighting = new CanBeSurroundedWithMetatagsHighlight(word,
                                                                                    range, decl, _solution);

                        highlightingConsumer.AddHighlighting(highlighting, range, file);
                    }
                    else if (spellCheck)
                    {
                        this.CheckWordSpelling(decl, wordRange, highlightingConsumer, range, file);
                    }
                }
            }
        }