/// <summary> /// Check that the given declaration has an xml documentation comment. /// </summary> /// <param name="declaration">The declaration to check</param> /// <param name="docNode">The documentation node to check.</param> /// <param name="consumer">The list of highlights (errors) that were found - add to this any new issues</param> public void CheckMemberHasComment(IClassMemberDeclaration declaration, XmlNode docNode, DefaultHighlightingConsumer consumer) { // Only process this one if its range is invalid. //if (!_daemonProcess.IsRangeInvalidated(declaration.GetDocumentRange())) return; // Check if the parent doco is null if (_xmlDocumentationSettings.SuppressIfBaseHasComment) { if (docNode == null && declaration.GetXMLDoc(true) != null) { return; } } if (docNode != null) { return; } Match[] publicMembers = new[] { new Match( Declaration.Any, AccessLevels.Public | AccessLevels.Protected | AccessLevels.ProtectedInternal) }; Match[] internalMembers = new[] { new Match(Declaration.Any, AccessLevels.Internal) }; Match[] privateMembers = new[] { new Match(Declaration.Any, AccessLevels.Private) }; Match match = ComplexMatchEvaluator.IsMatch(declaration, privateMembers, null, true); IFile containingFile = declaration.GetContainingFile(); if (match != null) { consumer.AddHighlighting( new PrivateMemberMissingXmlCommentHighlighting(declaration, match), containingFile.TranslateRangeForHighlighting(declaration.GetNameRange())); return; } match = ComplexMatchEvaluator.IsMatch(declaration, internalMembers, null, true); if (match != null) { consumer.AddHighlighting( new InternalMemberMissingXmlCommentHighlighting(declaration, match), containingFile.TranslateRangeForHighlighting(declaration.GetNameRange())); return; } match = ComplexMatchEvaluator.IsMatch(declaration, publicMembers, null, true); if (match != null) { consumer.AddHighlighting( new PublicMemberMissingXmlCommentHighlighting(declaration, match), containingFile.TranslateRangeForHighlighting(declaration.GetNameRange())); } }
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); } } } }